This commit is contained in:
@@ -416,6 +416,19 @@ namespace AyaNova.Util
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
//
|
||||
// Delete all attachments for object
|
||||
//
|
||||
internal static async Task DeleteAttachmentsForObjectAsync(AyaType ayaType, long ayaId, AyContext ct)
|
||||
{
|
||||
var deleteList = await ct.FileAttachment.Where(z => z.AttachToObjectId == ayaId && z.AttachToObjectType == ayaType).ToListAsync();
|
||||
foreach (var d in deleteList)
|
||||
{
|
||||
await DeleteFileAttachmentAsync(d, ct);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete a file attachment
|
||||
/// checks ref count and if would be zero deletes file physically
|
||||
@@ -540,12 +553,12 @@ namespace AyaNova.Util
|
||||
//got to be at least 32 chars
|
||||
if (FileName.Length < 32) return false;
|
||||
//probably all 64 chars but let's not count on that and go with folder is correct
|
||||
|
||||
|
||||
//what *should* the path be for a file of this name?
|
||||
var ExpectedFullPath=GetPermanentAttachmentFilePath(FileName);
|
||||
var ExpectedFullPath = GetPermanentAttachmentFilePath(FileName);
|
||||
//if expected equals real then it's very likely an orphaned file
|
||||
return fullPathName==ExpectedFullPath;
|
||||
|
||||
return fullPathName == ExpectedFullPath;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user