diff --git a/native/media/image-utils.js b/native/media/image-utils.js --- a/native/media/image-utils.js +++ b/native/media/image-utils.js @@ -13,11 +13,12 @@ import { generateThumbhashStep } from './media-utils.js'; type ProcessImageInfo = { - uri: string, - dimensions: Dimensions, - mime: string, - fileSize: number, - orientation: ?number, + +uri: string, + +filesystemURI: string, + +dimensions: Dimensions, + +mime: string, + +fileSize: number, + +orientation: ?number, }; type ProcessImageResponse = { success: true, @@ -33,7 +34,7 @@ const steps: Array = []; let { uri, dimensions, mime } = input; - const { fileSize, orientation } = input; + const { fileSize, orientation, filesystemURI } = input; const plan = getImageProcessingPlan({ inputMIME: mime, inputDimensions: dimensions, @@ -41,7 +42,7 @@ inputOrientation: orientation, }); if (plan.action === 'none') { - const thumbhashStep = await generateThumbhashStep(uri); + const thumbhashStep = await generateThumbhashStep(filesystemURI); steps.push(thumbhashStep); const { thumbHash } = thumbhashStep; return { diff --git a/native/media/media-utils.js b/native/media/media-utils.js --- a/native/media/media-utils.js +++ b/native/media/media-utils.js @@ -197,8 +197,8 @@ if (mediaType === 'video') { const { steps: videoSteps, result: videoResult } = await processVideo( { - // we pass selection.uri, because for processing videos filesystem - // uris don't work due to permissions + // We pass in selection.uri because our iOS transcoding module seems to + // have permission issues when passed a filesystem URI uri: selection.uri, mime, filename: selection.filename, @@ -224,8 +224,13 @@ } = videoResult); } else if (mediaType === 'photo') { const { steps: imageSteps, result: imageResult } = await processImage({ - // we pass selection.uri for consistency with videos + // We pass in selection.uri so that the returned imageResult.uri can be + // compared to selection.uri to determine if any processing occurred. + // processImage would be fine taking fileInfoResult.uri instead, but + // processVideo can't, which would force us to make the comparison below + // different in the image vs. video case uri: selection.uri, + filesystemURI: fileInfoResult.uri, dimensions, mime, fileSize,