Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

chore: adjust the regex for previewing images so that it only attempts to render if the image has a bracket immediately preceding the parentheses #608

Merged
merged 3 commits into from
Feb 17, 2025

Conversation

mayraamaral
Copy link
Contributor

@mayraamaral mayraamaral commented Feb 11, 2025

Problem

When the alt of an image has parentheses inside of it and previewImagesInEditor is true, the editor tries to render the image by making a GET with everything thats after the opening parentheses, e.g.:

![My alt (that has a parentheses)](my image url)

it tries to do a GET using the base url of the site + that has a parentheses)](my image url) and it results in a 404 error
Example:
http://localhost:8000/that%20has%20a%20parentheses)](my%20image%20url

Solution

in this PR i just fixed the regex that was used to match the src of an image 😄

@mayraamaral mayraamaral changed the title chore: adjust regex from previewing images to only try to render if image has bracket before of parentheses chore: adjust the regex for previewing images so that it only attempts to render if the image has a bracket immediately preceding the parentheses Feb 11, 2025
@mayraamaral
Copy link
Contributor Author

FYI @Ionaru,
I updated the actions to v4 and accidentally pushed the commit here, but I fixed it and opened this new PR: #609.

Please let me know if there’s anything else I can help with! 😄

@Ionaru
Copy link
Owner

Ionaru commented Feb 15, 2025

Thank you for the fix! I'll have some time tomorrow to fix the pipeline and get this PR merged :)

@mayraamaral
Copy link
Contributor Author

Thank you @Ionaru
Just merged the master branch with the PR 😄

@Ionaru
Copy link
Owner

Ionaru commented Feb 17, 2025

And I've added a test to verify the problem & solution :)

image-rendering.cy.js.mp4

@Ionaru Ionaru merged commit 22ce228 into Ionaru:master Feb 17, 2025
5 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants