Skip to content

Wordpress: Fix URLs with queries#1534

Merged
extesy merged 1 commit intoextesy:masterfrom
dubhater:master
Feb 5, 2025
Merged

Wordpress: Fix URLs with queries#1534
extesy merged 1 commit intoextesy:masterfrom
dubhater:master

Conversation

@dubhater
Copy link
Copy Markdown
Contributor

@dubhater dubhater commented Feb 5, 2025

Turn this:

https://i0.wp.com/lgbtqreads.com/wp-content/uploads/2024/02/JFP_MMN_COV_mksm.jpg?resize=197%2C300&ssl=1

into this:

https://i0.wp.com/lgbtqreads.com/wp-content/uploads/2024/02/JFP_MMN_COV_mksm.jpg

Also avoid breaking URLs with a resolution baked into the file name if they also have queries at the end:

https://i0.wp.com/lgbtqreads.com/wp-content/uploads/2024/12/ItsaLoveSkateRelationship-hc-c-678x1024-1.jpg?resize=199%2C300&ssl=1

"-678x1024" is supposed to be there.

Also handle URLs that don't have "wp-content" in them even though they're hosted at i0.wp.com:

https://i0.wp.com/i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1665507126l/58762417._SX318_.jpg?resize=187%2C279&ssl=1

Technically some of these should also have the ._crap_ removed, but I had enough.

Test page:
https://lgbtqreads.com/2025/02/05/happy-national-girls-and-women-in-sports-day-2025/

Turn this:

https://i0.wp.com/lgbtqreads.com/wp-content/uploads/2024/02/JFP_MMN_COV_mksm.jpg?resize=197%2C300&ssl=1

into this:

https://i0.wp.com/lgbtqreads.com/wp-content/uploads/2024/02/JFP_MMN_COV_mksm.jpg

Also avoid breaking URLs with a resolution baked into the file name if
they also have queries at the end:

https://i0.wp.com/lgbtqreads.com/wp-content/uploads/2024/12/ItsaLoveSkateRelationship-hc-c-678x1024-1.jpg?resize=199%2C300&ssl=1

"-678x1024" is supposed to be there.

Also handle URLs that don't have "wp-content" in them even though
they're hosted at i0.wp.com:

https://i0.wp.com/i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1665507126l/58762417._SX318_.jpg?resize=187%2C279&ssl=1

Technically some of these should also have the "._crap_" removed, but I
had enough.

Test page:
https://lgbtqreads.com/2025/02/05/happy-national-girls-and-women-in-sports-day-2025/

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Feb 5, 2025

@extesy extesy merged commit 429618d into extesy:master Feb 5, 2025
@extesy
Copy link
Copy Markdown
Owner

extesy commented Feb 5, 2025

Thank you for the contribution, @dubhater

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants