Make WordPress Core

Opened 14 months ago

Last modified 13 months ago

#57821 new defect (bug)

Media library badly autopopulates image caption if Windows image metadata exists

Reported by: properlypurple's profile properlypurple Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.1.1
Component: Media Keywords: has-testing-info has-screenshots
Focuses: administration Cc:

Description

If you upload an image which has specific metadata (Properties → Comments filled out on a Windows computer, with the Properties → Title field blank), the caption on the image in WP Admin autopopulates with a string of question marks.


Steps to reproduce

  1. On Windows, edit an image's properties in the file explorer so that the Comments field is populated, but the Title field is not.
  2. Upload the image to any site

What you expected to happen

The caption field in the Media library should either stay blank, or contain the actual "Comments" field contents.

What actually happened

The caption field for that file contains a string of question marks as long as your original comment text.

Attachments (3)

windows.png (31.9 KB) - added by properlypurple 14 months ago.
Screenshot of Windows properties dialog, showing the comments field
imagestotest.zip (5.5 MB) - added by properlypurple 14 months ago.
Zip file including two images, marked as 'buggy' and 'notbuggy'. It's the same image, and 'buggy' has the field 'Comments' updated using Windows properties dialog.
Screenshot 2023-02-28 at 18-33-51 Media Library ‹ Prickly Crane — WordPress.png (562.7 KB) - added by properlypurple 14 months ago.
Screenshot showing the actual issue

Change History (6)

@properlypurple
14 months ago

Screenshot of Windows properties dialog, showing the comments field

@properlypurple
14 months ago

Zip file including two images, marked as 'buggy' and 'notbuggy'. It's the same image, and 'buggy' has the field 'Comments' updated using Windows properties dialog.

#1 @properlypurple
14 months ago

Some additional findings

  • The properties field stores an EXIF tag called XPComment
  • I tried with different system locales, and was able to reproduce with English(US), English(India), and English(UK)
  • I tried to use exiftool to add an XPcomment field to an image, which has never touched Windows, and that didn't show this bug

exiftool -XPComment="some comment" 20221210_1352181.jpg

  • I found some documentation here about these tags ( https://exiv2.org/tags.html)
  • I updated the XPcomment tag on my reference image with exiftool, but the bug was still reproduced.

Output from the file command on both images attached to this ticket

❯ file buggy.jpg
buggy.jpg: JPEG image data, Exif standard: [TIFF image data, big-endian, direntries=15, manufacturer=FUJIFILM, model=X-E2S, orientation=upper-left, xresolution=2270, yresolution=2278, resolutionunit=2, software=Photos 0.2.4, datetime=2017:01:07 21:28:38], baseline, precision 8, 4896x3264, components 3

❯ file notbuggy.jpg
notbuggy.jpg: JPEG image data, Exif standard: [TIFF image data, little-endian, direntries=13, manufacturer=FUJIFILM, model=X-E2S, orientation=upper-left, xresolution=186, yresolution=194, resolutionunit=2, software=Photos 0.2.4, datetime=2017:01:07 21:28:38], baseline, precision 8, 4896x3264, components 3

This field is likely required to be encoded in a weird encoding called [UCS2](https://en.wikipedia.org/wiki/Universal_Coded_Character_Set), which is similar to UTF-16, but different.

#2 @shubhamgmath
13 months ago

Test Report

It is working fine with my images. But the buggy image share in the ticket reproduces the issue.

Env

  • WordPress 6.1.1
  • Chrome 111.0.5563.64
  • Mac OX Ventura version 13.2
  • Theme: Twenty Twenty Three
  • Media Library

Steps to test

  1. Download the images shared by the user and uploaded them to the media library
  2. Found the bug with that Image.
  3. Tried Changing the comment for my image and uploaded the same.
  4. But not found any issues.
  5. Replicated scenarios 2-3 with different images but not found any issues.

Screencast example:
Image giving issue - https://prnt.sc/gPsCslAXDENI

This ticket was mentioned in Slack in #core-test by juhise. View the logs.


13 months ago

Note: See TracTickets for help on using tickets.