mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +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 metadataKeysToRemove = [kCGImagePropertyGPSDictionary: kCFNull]
|
||||||
|
|
||||||
let data = NSMutableData()
|
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
|
throw .failedStrippingLocationData
|
||||||
}
|
}
|
||||||
|
|
||||||
CGImageDestinationAddImageFromSource(destination, imageSource, 0, metadataKeysToRemove as NSDictionary)
|
CGImageDestinationAddImageFromSource(destination, imageSource, 0, metadataKeysToRemove as NSDictionary)
|
||||||
CGImageDestinationFinalize(destination)
|
CGImageDestinationFinalize(destination)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user