CR: Delete thumbnail with directory

// FREEBIE
pull/1/head
Michael Kirk 7 years ago
parent 8e9eb6d212
commit 32bf9d52a1

@ -260,12 +260,22 @@ NS_ASSUME_NONNULL_BEGIN
- (void)removeFileWithTransaction:(YapDatabaseReadWriteTransaction *)transaction
{
NSError *error;
NSString *_Nullable thumbnailPath = self.thumbnailPath;
if (thumbnailPath) {
[[NSFileManager defaultManager] removeItemAtPath:thumbnailPath error:&error];
if (error) {
DDLogError(@"%@ remove thumbnail errored with: %@", self.logTag, error);
}
}
NSString *_Nullable filePath = self.filePath;
if (!filePath) {
OWSFail(@"%@ Missing path for attachment.", self.logTag);
return;
}
NSError *error;
[[NSFileManager defaultManager] removeItemAtPath:filePath error:&error];
if (error) {
@ -345,7 +355,8 @@ NS_ASSUME_NONNULL_BEGIN
}
if (![[NSFileManager defaultManager] fileExistsAtPath:self.mediaURL.path]) {
OWSFail(@"%@ while generating thumbnail, source file doesn't exist: %@", self.logTag, self.mediaURL) return;
OWSFail(@"%@ while generating thumbnail, source file doesn't exist: %@", self.logTag, self.mediaURL);
return;
}
// TODO proper resolution?

Loading…
Cancel
Save