Open iuravic opened 8 months ago
Generally I think we should use PHP 8 return declarations on functions now that we have left PHP 7 behind, so I'd love to also see them. (feel free to also ignore that one).
Agreed, I think we're ready to add this to our PHPCS standard. Feel free to if you'd like.
This PR
Subsizes does not allow attachment filenames to end in -\d+x\d+, e.g.
image-100x200.jpg
. If you upload a file like that to Atomic, it will be accepted, but a-1
will be appended to its filename and attachment post object's post_name, e.g. you will getimage-100x200-1.jpg
uploaded to your media library. If we're cloning historic WP sites to Atomic, such images won't work once Subsizes starts appending its size suffixes.This PR fixes those attachments by:
Caveat!
This needs to be run before conversion to blocks. Because conversion to blocks might append an additional -\d+x\d+ on top of the existing old -\d+x\d+. E.g. invalid image in HTML
Dorothy-336x225.jpg
might be updated toDorothy-336x225-336x225.jpg
by Gutenberg. So it's important to run this before converting to blocks.How to test
image-100x200.jpg
image-100x200.jpg
has been renamed toimage-100x200-1.jpg
both in Media Library's URL to image, and in posts where this image was used