Automattic / Automattic/jetpack
Images break when there is a space in the filename
- Dominant language
- PHP
- Stars
- 1.8k
- Forks
- 898
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 774
Description
### Impacted plugin
Search
### Quick summary
Images with spaces in their filenames do not appear in Jetpack Search results when Jetpack's image optimization (Photon) is disabled. The issue seems to arise due to improper encoding of Unicode characters in the image URLs, leading to mismatches between the stored image URL and the URL generated for search results.
### Steps to reproduce
To see an example, go to https://walkingmiller.wpcomstaging.com/ and perform a search for "try".
To reproduce on a fresh install:
1. Disable Jetpack's image optimization (Photon).
2. Upload an image with spaces or special characters in the filename.
3. Perform a search in Jetpack Search for posts containing the image.
4. Observe that the image does not appear due to a malformed URL.
### A clear and concise description of what you expected to happen.
Images with spaces in their filenames should have shown up in the search results.
### What actually happened
Images with spaces in their filenames did not show up in the search results.
### Impact
All
### Available workarounds?
Yes, easy to implement
### If the above answer is "Yes...", outline the workaround.
If you enable JP Image Optimization, it will correctly encode the filename of the image before JP search accesses the photo.
### Platform (Simple and/or Atomic)
Atomic, Self-hosted
### Logs or notes
Internal reference: p1735855987401589-slack-C018UMRUN3V
Contributor guide
Research direction
Start by reproducing the issue on the linked staging site or a fresh install with Photon disabled, then trace how Jetpack Search stores and generates image URLs for filenames containing spaces or special characters. Done means those images appear in search results with correctly encoded URLs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, wordpress
- Domain
- backend, search
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100