WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.49k stars 4.19k forks source link

Upload external media replaces images in wrong order and/or creates duplicates #65281

Closed traed closed 1 month ago

traed commented 1 month ago

Description

When copy-pasting content with several images from e.g. google docs and hitting Publish, an option to upload external images appears. Sometimes when using it the images in the editor gets replaces by the wrong image after the upload is done. So that if a document had images A, B and C, after the upload is done B and C are replaces by copies of A.

Step-by-step reproduction instructions

  1. Copy all content from a google doc with multiple different images
  2. Paste it into the WP editor
  3. Hit publish and then Upload when prompted
  4. After the upload is done the images in the editor are replaces incorrectly

Screenshots, screen recording, code snippet

Google doc with example content: https://docs.google.com/document/d/1FSNt8QQFofPu27PvoUOo7Gwq1hedkoNoD1t2_KuSFAo/edit?usp=sharing

Screen recording: https://drive.google.com/file/d/1O2WXbaTrGUHFUmToyc8iYdVPsIjmNncv/view?usp=sharing

Environment info

Please confirm that you have searched existing issues in the repo.

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Mamaduka commented 1 month ago

Thanks for reporting the issue, @traed!

This looks similar to #64899, which was fixed via #65122.

cc @sgomes

sgomes commented 1 month ago

Thank you for the mention, @Mamaduka! 👍 Yes, that does indeed seem like a similar issue to #64899, I agree.

@traed: If you have the opportunity to give trunk a try, please let me know if that fixes things for you!

Mamaduka commented 1 month ago

@traed, @sgomes, I just tested using trunk and provided test Google Document. The images are uploaded and replaced correctly.

sgomes commented 1 month ago

Thank you so much, @Mamaduka! 🙌

Mamaduka commented 1 month ago

I'm going to close the issue. The bug has been fixed in Gutenberg trunk.