-
Notifications
You must be signed in to change notification settings - Fork 213
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 linkify to only link to proper URLs #5920
Conversation
28f5b98
to
e36fd22
Compare
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.
+1
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5920 +/- ##
=======================================
Coverage 98.73% 98.73%
=======================================
Files 395 395
Lines 38764 38770 +6
=======================================
+ Hits 38275 38281 +6
Misses 489 489 ☔ View full report in Codecov by Sentry. |
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.
Looks generally good. I think this is the right approach.
5f3cabc
to
c9721ce
Compare
I added a test |
This doesn't check for really well formed URLs, but it limits the matching to only allowed characters in URIs. It makes up for escapeForHtml() being already called, so it matches `&` separately. Tested with: # "> should be excluded "https://github.com/os-autoinst/openQA.git" <https://github.com/os-autoinst/os-autoinst.git> # ) should be included https://de.wikipedia.org/wiki/Queen_(Band) # query strings should be included https://github.com/os-autoinst/openQA?foo=1%20&bar=*2 Single quotes actually can be part of URIs so that's something we should adapt in our code (and use double quotes, or I remember back in usenet times we used `<http://...>` whenever referring to a URL in plain text) Issue: https://progress.opensuse.org/issues/166676
c9721ce
to
61be703
Compare
Solution provided on os-autoinst/openQA#5920 and this is a adaptable change to that commit as unescaped single quotes are valid parts of URIs https://progress.opensuse.org/issues/166676 [0] https://github.com/IonicaBizau/anser/tree/master?tab=readme-ov-file#anserlinkifytxt Signed-off-by: ybonatakis <[email protected]>
Solution provided on os-autoinst/openQA#5920 and this is a adaptable change to that commit as unescaped single quotes are valid parts of URIs https://progress.opensuse.org/issues/166676 Signed-off-by: ybonatakis <[email protected]>
This doesn't check for really well formed URLs, but it limits the matching to only allowed characters in URIs.
It makes up for escapeForHtml() being already called, so it matches
&
separately.Tested with:
Single quotes actually can be part of URIs so that's something we should adapt
in our code (and use double quotes, or I remember back in usenet times we used
<http://...>
whenever referring to a URL in plain text).We could use this as a workaround until an according PR to https://github.com/IonicaBizau/anser has been made.
There is a related issue: IonicaBizau/anser#63
Alternative to
Issue: https://progress.opensuse.org/issues/166676