Skip to content

Awkward behavior regarding library items portability #69965

@T4ngml

Description

@T4ngml

Description

I'm currently rebuilding my website using custom blocks.
During this process, once the blocks are developed, I first build the posts/pages in a staging environment. Then I take advantage of the "Copy All Blocks" feature to copy the entire content into a new post on the live website.

The media I uploaded on the staging site is also present on the live site, but with absolute URLs.
It's not immediately obvious unless you look for it, but I quickly realized that the image block copied here retain the absolute path (from the staging environment). This isn’t ideal for my workflow, altough I suppose it probably make more sense for diffent use cases.

What’s worse, though, is that when I try to replace a media file with it's live website same image, then the image won't actually get replaced. The media from the staging site remains, even though I did select and confirm the replacement from the live website Media Library.

The only workaround I’ve found is to click "Reset" first, then search for the image again in the library.

How comes? Won't the path get checked if the filename remains the same?

Thanks.

Step-by-step reproduction instructions

  1. Build a page with images blocks on a staging environment
  2. Click Copy All Blocks from the top-right 3-dots menu button.
  3. Create a new page the live website (which is the very same site the staging one)
  4. Paste
  5. Check the image URL (ex: right click on it > open it in a new tab >> it still has the staging environment domain)
  6. Click Replace > Open Media Library > Look for the same image in this environment > Update > Click on it > Click Select, to get back to the editor
  7. Check the image >> It's still the previous one, from the staging environment
  8. Click Replace > Reset > Replace > Media Library > Look for the same image > Select
  9. Check the images >> Now it's the right image...

Screenshots, screen recording, code snippet

No response

Environment info

WordPress v6.7.2
Theme: Storefront v4.6.1
Web Browser: Chromium 134.0.6998.178
Windows 11 Pro

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

  • Yes

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

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Metadata

Metadata

Assignees

Labels

[Block] ImageAffects the Image Block[Feature] MediaAnything that impacts the experience of managing media[Type] BugAn existing feature does not function as intended

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions