[wp-trac] [WordPress Trac] #63180: Media Library Incorrectly Identifies Non-Identical Filenames as Duplicates
WordPress Trac
noreply at wordpress.org
Wed Mar 26 15:15:34 UTC 2025
#63180: Media Library Incorrectly Identifies Non-Identical Filenames as Duplicates
--------------------------+-----------------------------
Reporter: zahnd | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version: 6.7.2
Severity: normal | Keywords: needs-patch
Focuses: |
--------------------------+-----------------------------
The WordPress Media Library's duplicate detection system incorrectly
identifies files as duplicates when one filename is a substring of
another, even though they are distinct files.
Steps to Reproduce:
1. Upload an image named "101iw500501.jpg"
2. Upload a different image named "500501.jpg"
3. Observe that WordPress treats the second file as a duplicate of the
first, appending a suffix (e.g., "-1")
This does not apply the other way around. If the image "500501.jpg" is
uploaded first, the second image, "101iw500501.jpg," will be treated as a
distinct, new image.
I noticed the issue the first time using the API to upload images and
verified it using the WP backend and Media Manager.
Expected Behavior:
- WordPress should only consider files as duplicates if their filenames
are identical
- "101iw500501.jpg" and "500501.jpg" should be treated as distinct files,
as they represent different product SKUs
Impact:
In our case, we sync products from an external ERP into WooCommerce and
keep data in sync. Therefore, if the second image is treated as a
duplicate and stored with a suffix (-1, -2, etc.), it will not be
recognized as an existing, matching image in the next sync run and will be
continuously uploaded again with a new suffix.
Use Case Example:
In our WooCommerce integration:
1. ERP sends image file names like "101iw500501.jpg"
2. The corresponding image is named "101iw500501.jpg"
3. Another product is sent with the image file "500501.jpg"
4. WordPress renames it to "500501-1.jpg" because "101iw500501.jpg" exists
5. The synchronization system fails to match the existing image in
WordPress with the one sent from the ERP
6. This requires manual intervention to correct the image-product
association
Environment:
- WordPress Version: 6.7.2
- PHP Version: 8.1.31
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63180>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list