expo-image-picker will always copy the contents of image into cache and provide a URL to cached image:
As a result we'll ALWAYS need to unlink the selection.uri. We also clean up processedMedia.uploadURI if necessary.
Differential D7704
[native] Unlink files as necessary in `useUploadSelectedMedia` atul on May 2 2023, 12:59 PM. Authored by Tags None Referenced Files
Subscribers
Details expo-image-picker will always copy the contents of image into cache and provide a URL to cached image: As a result we'll ALWAYS need to unlink the selection.uri. We also clean up processedMedia.uploadURI if necessary. Tested small images which weren't processed and large images which were processed. Logged the contents of selection, processedMedia, and urisToBeDisposed. When I commented out the unlink line (159), I was able to open all of the images in Finder. When I uncommented the unlink line, all of the images were inaccessible because they'd been removed: Before: After: Tested Android by ensuring that files remained in caches when unlink was commented out and weren't in caches when unlink was uncommented: Selected an image avatar and ensured contents were as before: Selected an image avatar with unlink left out and observed that new files were added:
Diff Detail
Event Timeline
Comment Actions Please amend test plan to include testing Android as well as iOS. Also, can we not pass filesystem.unlink in directly, without needing an extra lambda?
Comment Actions
Yeah, had some temporary logging within the forEach, will pass in filesystem.unlink directly.
|