Automattic / Automattic/jetpack

Image Compare Block: full image URLs are saved in post content, with CDN URL if used

Open
#39,295 1 comment 1 reaction 0 assignees View on GitHub
[Block] Image Compare [Feature] Photon [Platform] Atomic [Plugin] Jetpack [Pri] Low [Status] Stale Bug Triaged
Dominant language
PHP
Stars
1.8k
Forks
898
Avg merge
1d 18h
Merged PRs (30d)
774

Description

### Impacted plugin

Jetpack

### Quick summary

When using the Image Compare Block, the full image URL is saved in the post content. It's problematic when using an image CDN like Photon. If that CDN is then deactivated or its URL changes, the images in the post content will continue to use the old CDN URL

### Steps to reproduce

1. Start with a site using the Jetpack plugin, connected to WordPress.com.
2. Go to Jetpack > Settings > Performance, and activate the Site Accelerator feature.
3. Go to Posts > Add New
4. Add an Image Compare Block
5. Upload 2 images, and publish your post.
6. Visit the post on the frontend, and open your browser's dev tools.
7. The images use the CDN URL.
8. Edit the post, and switch to the code editor view.
9. You'll see that the images stored in the post content are the full image URLs, with the `i0.wp.com` prefix.
10. Now go to Jetpack > Settings > Performance again, and deactivate the Site Accelerator feature.
11. Go back to the post.

### A clear and concise description of what you expected to happen.

I would expect the post to not use the CDN URL anymore.

### What actually happened

Instead, it still uses the image CDN since the full image was stored in the post content.

### Impact

Some (< 50%)

### Available workarounds?

No but the platform is still usable

### If the above answer is "Yes...", outline the workaround.

_No response_

### Platform (Simple and/or Atomic)

Atomic, Self-hosted

### Logs or notes

Reported here:
https://wordpress.org/support/topic/bug-in-image-compare-block/

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Image Compare Block steps with Jetpack Site Accelerator enabled, then inspect how the block serializes uploaded image URLs in post content. Confirm the stored content and frontend output before and after deactivating the accelerator; done means posts no longer retain the old CDN URL.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react, wordpress
Domain
frontend, performance
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.