Delete local files when DraftAttachment deleted

This commit is contained in:
Shadowfacts 2023-04-23 14:44:11 -04:00
parent 4401503b85
commit b3d5ed8505
1 changed files with 7 additions and 0 deletions

View File

@ -58,6 +58,13 @@ public final class DraftAttachment: NSManagedObject, Identifiable {
case file(URL, UTType) case file(URL, UTType)
} }
public override func prepareForDeletion() {
super.prepareForDeletion()
if let fileURL {
try? FileManager.default.removeItem(at: fileURL)
}
}
} }
extension DraftAttachment { extension DraftAttachment {