The behaviour appears to be when the image filename contains a special character, for example, _ or -. This is a very common use case as often, images provided by suppliers and manufacturers have filenames that are the same as the product SKU. We've reached out to the Shopify dev team but no solution thus far.
Has anyone else run into this and figured out a workaround? Shopify support, we'd appreciate a response too if you have the solution. This started happening about 4-6 weeks ago so it looks like there was a change on your side.
1. Importing images via API
2. If image filename contains a special character, a duplicate image is added to the product
Just ran into this myself, and I can't even tell what teh exact fauty behavior is, but it seems to be beyond just special chars, such as "_" or "-".
I have 9 images for a product, named "product-image-1.jpg, product-image-2.jpg, ..." etc.
When I open a brand new, clean store, with nothing uploaded or download or installed to it, and I ush this product to Shopify via API, it uploads the first 5-6 images appropariately, as they are named, "product-image-1.jpg, product-image-2.jpg, product-image-3.jpg, product-image-4.jpg, product-image-5.jpg."
But then the next 4 it uploads as something like "product-image-6_isduhf-987sdf-sudhf89-8sydgf.jpg" ...
I can't figure out what it is, and all I've found so far is threads that say this is done when there is a duplicate named image. But there are no duplicate images on the new store. And none of the images are duplicate names on the original store, from which I'm pushing/pulling products, as I checked, and if there were, they would already have been renamed by Shopify on the original store anyway.
I discover this when I go to use the API AFTER already uploading the images, to assosciate them with their variants on the new store.
To do that I use a "map" of old store images VS SKUs, but when I go to upload them, the image filenames have been changed from the original name on the old store, to a new name, as if there were already duplicate images with the same names on the new store.