Skip to content

Upload: drop duplicate images and display warning in normal selector#6772

Open
Akul-Tyagi wants to merge 1 commit intocommons-app:mainfrom
Akul-Tyagi:fix/normal-selector-duplicate-warning
Open

Upload: drop duplicate images and display warning in normal selector#6772
Akul-Tyagi wants to merge 1 commit intocommons-app:mainfrom
Akul-Tyagi:fix/normal-selector-duplicate-warning

Conversation

@Akul-Tyagi
Copy link
Contributor

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.kt to:

  • Detect duplicate content images before passing the selection to the upload screen.
  • Automatically drop the duplicates, keeping only unique images.
  • Show a warning to the user notifying them that duplicate images were removed, so the count reduction is never silent or confusing.

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

  • Compiled and ran the betaDebug variant successfully.
  • Passed targeted unit tests: :app:testBetaDebugUnitTest --tests "fr.free.nrw.commons.contributions.ContributionControllerTest"
  • Manually verified that the duplicate warning is shown when identical images are selected via the normal selector.
  • Manually verified that the upload screen receives only the deduplicated set of images.
  • Manually verified that non-duplicate selections pass through normally with no warning shown.

Videos

Before:

Screen_Recording_20260321_181700_Commons.mp4

After:

Screen_Recording_20260321_181512_Commons.mp4

@github-actions
Copy link

✅ Generated APK variants!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Normal selector silently allows duplicate content images without warning

1 participant