forked from shadowfacts/Tusker
Delete local files when DraftAttachment deleted
This commit is contained in:
parent
4401503b85
commit
b3d5ed8505
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue