breautek commented on PR #896: URL: https://github.com/apache/cordova-plugin-camera/pull/896#issuecomment-2439044503
@byronaltice Looking for some opinions... I have drafted https://github.com/apache/cordova-plugin-camera/pull/907 (https://github.com/apache/cordova-plugin-camera/pull/907/commits/242cd45be8e81bece437902176160ebc24a4119e for the actual changes specific to that PR) which completely removes `checkForDuplicateImage` and tracking the `numpics`. The details are in #907 but I'll summarise the rationale here. The code obviously is attempting to determine if capturing an image is resulting in a duplicate entry in the gallery. I'm assuming this is if the user is also using `saveToPhotoAlbum` option on image captures, but the camera intent also stores the captured image in the gallery. It's also ancient, this was in the code base since the initial commit, so it's hard to say for certain. I can say in my testing, I'm not seeing any duplicates. Overall the code works is it queries the media store and counts how many images are available when you start capturing a picture. And then it does it again at the end of processing the captured photo to determine if there was a duplicate. The problem I have though is if you think about it logically, any app at any time can insert images or media into the gallery. If this occurs, it will obviously trip up these count checks. I don't see how this guarantees that it is even selecting the "duplicate" image to delete. I think it is possible that the camera could be attempting to delete a completely unrelated photo. Even if some camera apps insert the captured photo themselves, which would cause a duplicate if `saveToPhotoAlbum` is used, the way this handling that "duplicate" is unsafe, in my opinion. Wondering if you have some time to analyse and see if you can come to the same conclusion? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org