Retrying upload for a previously upload failed image should not result in duplicate images in the media library.
If you upload more than one images at once and upload fails for an image, then on retrying to upload makes duplicate copies in the media library.
(Tested on a self-hosted site. Might also be reproducible on a simple WP site.)
Attempt 1: https://cloudup.com/izjkk0AITDc (Duplicate media on timestamp 1:14)
Attempt 2: https://cloudup.com/iydwecO-FxC (Duplicate media on timestamp 1:53)
This is probably not related, but I thought I'd better drop a comment just to be sure. When we were dealing with posts being duplicated after retry, we came to a conclusion that it cannot be prevented without making changes to the API.
If the app sends a POST request and goes offline, the server will still process the request. However, the app will never receive a response so it assumes the request failed. Retry will send the same request again - however, since the post doesn't exist on the server yet, it doesn't have remote ID so it's treated by the server as a different post => duplicated post gets created.
I think it'll probably not be related to this issue, since images/files upload takes a while and the device would need to go offline in the exact right moment (the last byte was sent but the server didn't send a response yet).
Thanks @malinajirka !
If the app sends a POST request and goes offline, the server will still process the request. However, the app will never receive a response so it assumes the request failed. Retry will send the same request again
This is exactly what is happening in this case. This is how I verified:
I could see duplicate images issue even for a post with id.


we came to a conclusion that it cannot be prevented without making changes to the API.
Looks like same conclusion applies in this case.