Skip to content

Fix image wrapping logic and regex#2

Open
ddegner wants to merge 2 commits into
mainfrom
cursor/fix-image-wrapping-logic-and-regex-26b9
Open

Fix image wrapping logic and regex#2
ddegner wants to merge 2 commits into
mainfrom
cursor/fix-image-wrapping-logic-and-regex-26b9

Conversation

@ddegner

@ddegner ddegner commented Aug 11, 2025

Copy link
Copy Markdown
Owner

Fixes wrapContentImages() to correctly process images with query strings and avoid skipping valid <img> tags due to unrelated <picture> or AVIF content.

The original wrapContentImages() function had a global early-return that prevented any image wrapping if the content contained <picture> or type="image/avif". This meant that even plain <img> tags would not be processed if these elements were present elsewhere. Additionally, the regex used to find <img> tags did not account for query strings after the file extension, causing images like image.jpg?ver=123 to be missed. This PR addresses both issues by removing the global early-return, processing all <img> tags while skipping only those already nested within a <picture>, and updating the regex to correctly match URLs with query strings. It also ensures avifUrlFor() handles query strings correctly.


Open in Cursor Open in Web

…nd picture tags

Co-authored-by: dingoes-51.slots <dingoes-51.slots@icloud.com>
@cursor

cursor Bot commented Aug 11, 2025

Copy link
Copy Markdown

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

Co-authored-by: dingoes-51.slots <dingoes-51.slots@icloud.com>
@ddegner
ddegner marked this pull request as ready for review August 11, 2025 19:38
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