Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years 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's profile azaozz Owned by: azaozz's profile 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 4 years ago.

Download all attachments as: .zip

Change History (6)

@azaozz
4 years ago

#1 @azaozz
4 years 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.


4 years ago
#2

  • Keywords has-patch has-unit-tests added

#3 @azaozz
4 years ago

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

#4 @azaozz
4 years 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.