Upload: drop duplicate images and display warning in normal selector#6772
Upload: drop duplicate images and display warning in normal selector#6772Akul-Tyagi wants to merge 4 commits into
Conversation
|
Nice — the SHA1-based dedup logic mirrors #6765's approach for the custom selector, and the wiring (via One real problem though: this PR and #6765 both independently add a string resource named |
|
✅ Generated APK variants! |
|
Hi @chrisdebian, thank you for pointing out the potential resource collision! Since these two PRs might merge independently, I've renamed the string resource in this PR specifically to normal_selector_duplicates_warning (and updated PR #6765 to use a custom-selector specific name as well). This guarantees there won't be any build errors or merge conflicts regardless of which PR lands first. |
Fixes #6771
The Problem
In the normal selector flow, duplicate content images (files sharing the same content hash) were silently passed through to the upload screen with no deduplication or user notification. This could result in redundant uploads to the Commons server and created an inconsistency with the custom selector, which already performs duplicate detection (see issue #6764 / PR #6765 ).
The Solution & Justification
I updated the normal selector's completion flow in
ContributionController.ktto:This brings the normal selector's duplicate handling to full parity with the custom selector fix in #6765 , and ensures a consistent, transparent experience across both upload flows.
Alternative Solutions Considered
I considered passing duplicates through and only showing a warning (preserving the count), similar to what was initially proposed in #6765 . However, per the direction established in #6765 , dropping duplicates and warning the user is the correct approach, as duplicate uploads are genuinely unhelpful and should be prevented at the source rather than silently permitted.
Testing Performed
betaDebugvariant successfully.:app:testBetaDebugUnitTest --tests "fr.free.nrw.commons.contributions.ContributionControllerTest"Videos
Before:
Screen_Recording_20260321_181700_Commons.mp4
After:
Screen_Recording_20260321_181512_Commons.mp4