-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(link): Don't throw exception on invalid URL href #6794
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6794 +/- ##
==========================================
+ Coverage 46.86% 46.89% +0.02%
==========================================
Files 747 732 -15
Lines 34080 34065 -15
Branches 1240 1226 -14
==========================================
+ Hits 15973 15976 +3
+ Misses 17486 17483 -3
+ Partials 621 606 -15 ☔ View full report in Codecov by Sentry. |
/backport to stable30 |
/backport to stable29 |
src/marks/Link.js
Outdated
? domHref(mark, this.options.relativePath) | ||
: '#' | ||
} catch (error) { | ||
href = mark.attrs.href |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd also fall back to '#'
here as we have no way of checking if this is a protocol we actually want to link to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, changed now.
The Reuse check failure is really odd... looks like there are some licenses we sometimes use and sometimes don't. |
When pasting strings with invalid URLs, `new URL()` in `renderHTML()` of the Link extension threw an error, which made the paste parser choke. We should catch this exception and handle it gracefully to not break HTML parsing completely with invalid URLs. Signed-off-by: Jonas <[email protected]>
6b7e145
to
d182756
Compare
When pasting strings with invalid URLs,
new URL()
inrenderHTML()
of the Link extension threw an error, which made the paste parser choke.We should catch this exception and handle it gracefully to not break HTML parsing completely with invalid URLs.
🏁 Checklist
npm run lint
/npm run stylelint
/composer run cs:check
)