Automattic / Automattic/jetpack
Uploaded image metadata has escaped quotes
- Dominant language
- PHP
- Stars
- 1.8k
- Forks
- 898
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 774
Description
Uploading an image via the [WordPress.com API](https://developer.wordpress.com/docs/api/1.1/post/sites/%24site/media/new/) to a Jetpack blog and setting either the caption or title to a string that includes a single quote results in the quotes being escaped inside WordPress.
#### Steps to reproduce the issue
I'm using the [Lightroom](https://apps.wordpress.com/lightroom/) plugin here which issues a `/media/new` request with the appropriate values set for caption and title. The same effect should be reproducable via other means (I reproduced it using curl)
1. Export a photo to a WordPress.com blog with a title and caption that includes a single quote. Note that the media library correctly shows the values:

2. Export the same photo with the same title/caption to a Jetpack site and note that the media library shows escaped values:

This is using Jetpack 4.5, WP 4.7.1, and PHP 7.0. The same behaviour has been seen on another host with PHP 5.6 and the same WP and Jetpack 4.4.2.
I'm not sure whether the problem is in the Jetpack plugin itself, or in the Jetpack part of the API, but I'm logging it here as it only affects Jetpack blogs.
Contributor guide
Research direction
Start by reproducing the issue with a /media/new request using curl, a title, and a caption containing a single quote, then compare Jetpack and WordPress.com behavior. Trace the Jetpack-side API handling for those fields and determine where the extra escaping is introduced; done means the Jetpack media library displays the original quote without escaping.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100