diff --git a/Signal/src/ViewControllers/ConversationView/MessagesViewController.m b/Signal/src/ViewControllers/ConversationView/MessagesViewController.m index 173058a5c..71851ed6a 100644 --- a/Signal/src/ViewControllers/ConversationView/MessagesViewController.m +++ b/Signal/src/ViewControllers/ConversationView/MessagesViewController.m @@ -3311,6 +3311,8 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) { } else { // Non-Video image picked from library + // To avoid re-encoding GIF and PNG's as JPEG we have to get the raw data of + // the selected item vs. using the UIImagePickerControllerOriginalImage NSURL *assetURL = info[UIImagePickerControllerReferenceURL]; PHAsset *asset = [[PHAsset fetchAssetsWithALAssetURLs:@[ assetURL ] options:nil] lastObject]; if (!asset) { diff --git a/Signal/src/ViewControllers/SignalAttachment.swift b/Signal/src/ViewControllers/SignalAttachment.swift index d56593292..42328499b 100644 --- a/Signal/src/ViewControllers/SignalAttachment.swift +++ b/Signal/src/ViewControllers/SignalAttachment.swift @@ -251,7 +251,12 @@ class SignalAttachment: NSObject { // Image attachments may be converted to another image format before // being uploaded. private class var inputImageUTISet: Set { - return MIMETypeUtil.supportedImageUTITypes().union(animatedImageUTISet) + // HEIC is valid input, but not valid output. Non-iOS11 clients do not support it. + let heicSet: Set = Set(["public.heic"]) + + return MIMETypeUtil.supportedImageUTITypes() + .union(animatedImageUTISet) + .union(heicSet) } // Returns the set of UTIs that correspond to valid _output_ image formats @@ -441,7 +446,7 @@ class SignalAttachment: NSObject { } guard imageData.count > 0 else { - assert(imageData.count > 0) + owsFail("\(self.TAG) in \(#function) imageData was empty") attachment.error = .invalidData return attachment }