mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
Closes #4477 - Fix stripping location data away from raw images when processing them for upload
This commit is contained in:
committed by
Stefan Ceriu
parent
2b155d5db3
commit
13eb54fa37
@@ -316,9 +316,15 @@ struct MediaUploadingPreprocessor {
|
||||
let metadataKeysToRemove = [kCGImagePropertyGPSDictionary: kCFNull]
|
||||
|
||||
let data = NSMutableData()
|
||||
guard let destination = CGImageDestinationCreateWithData(data as CFMutableData, type.identifier as CFString, count, nil) else {
|
||||
|
||||
// Certain type identifiers cannot be used for image destinations, fall
|
||||
// back to `public.jpeg` when that's the case
|
||||
let destination = CGImageDestinationCreateWithData(data as CFMutableData, type.identifier as CFString, count, nil) ??
|
||||
CGImageDestinationCreateWithData(data as CFMutableData, UTType.jpeg.identifier as CFString, count, nil)
|
||||
guard let destination else {
|
||||
throw .failedStrippingLocationData
|
||||
}
|
||||
|
||||
CGImageDestinationAddImageFromSource(destination, imageSource, 0, metadataKeysToRemove as NSDictionary)
|
||||
CGImageDestinationFinalize(destination)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user