WordPress.org

Make WordPress Core

Opened 8 months ago

Closed 8 months ago

Last modified 8 months ago

#50628 closed defect (bug) (fixed)

Media: wp_image_file_matches_image_meta() doesn't match when the original_image URL is used

Reported by: azaozz Owned by: azaozz
Milestone: 5.5 Priority: normal
Severity: normal Version: 5.5
Component: Media Keywords: has-patch has-unit-tests
Focuses: Cc:

Description

This is an edge case in the (new) wp_image_file_matches_image_meta().

Attachments (1)

50628.diff (8.6 KB) - added by azaozz 8 months ago.

Download all attachments as: .zip

Change History (6)

@azaozz
8 months ago

#1 @azaozz
8 months ago

In 50628.diff:

  • Fix wp_image_file_matches_image_meta() to also look at original_image when present.
  • Add unit test.
  • Replace test-image-large.png with test-image-large.jpg in tests/phpunit/data/images/. The new image is larger and the $image_meta for it has original_image (PNG images are not scaled by default).
  • Fix and improve older tests to use the replaced image.

This ticket was mentioned in PR #399 on WordPress/wordpress-develop by azaozz.


8 months ago

  • Keywords has-patch has-unit-tests added

#3 @azaozz
8 months ago

Made a PR so the tests can be tested beforehand :)

#4 @azaozz
8 months ago

  • Owner set to azaozz
  • Resolution set to fixed
  • Status changed from new to closed

In 48454:

Media: Fix wp_image_file_matches_image_meta() to also match when the original image URL is used.

Also refreshes and fixes some of the unit tests for media, and replaces test-image-large.png with test-image-large.jpg which is larger to allow testing of original_image in the image meta.

Fixes #50628.

Note: See TracTickets for help on using tickets.