react-native-image-picker icon indicating copy to clipboard operation
react-native-image-picker copied to clipboard

[🐛] Duplicate Cached Files On Android - Gallery Selection

Open mattlewer opened this issue 1 year ago • 5 comments

Description

When selecting a single image/video from the gallery on Android, two are created in the cache folder of the app storage.

This may to be due to two calls to getAppSpecificStorageUri within the Utils.java file. The second of these is called from getOriginalFilePath which was added on V7.0.0 here https://github.com/react-native-image-picker/react-native-image-picker/commit/7086e95f555bf61143837f3fa8cb4d8a83491b97 , this is also the file that is the duplicate.

This is preventing us cleaning up left over cache files.

As shown in the below image, two file paths are created, the final log is from the React Native side, only one is fed back, but the other still exists in cache. Screenshot 2024-02-09 at 15 47 47 Screenshot 2024-02-09 at 15 52 52

How to repeat issue and example

  • Select a single image from the gallery
  • View cache directory of app using Android Studio

Solution

Prevent multiple files being cached when only a single item was selected.

Additional Information

  • Image Picker version: 7.0.2
  • React Native version: 0.72.6
  • Platform: Android
  • Development Operating System: MacOS
  • Dev tools: Android Studio Hedgehog | 2023.1.1

mattlewer avatar Feb 09 '24 15:02 mattlewer

@Johan-dutoit Any updates on this?

mattlewer avatar Feb 27 '24 13:02 mattlewer

I got the same issue...

mdottavi avatar May 09 '24 12:05 mdottavi

same issue, any plans on this getting fixed?

estrayer7 avatar Aug 13 '24 18:08 estrayer7

@mattlewer Still same issue

parthjdabhi avatar Aug 21 '24 07:08 parthjdabhi