-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Modify linkRegex to require http|https #6153
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6153 +/- ##
==========================================
+ Coverage 38.83% 38.84% +<.01%
==========================================
Files 354 354
Lines 50183 50183
==========================================
+ Hits 19490 19494 +4
+ Misses 27868 27863 -5
- Partials 2825 2826 +1
Continue to review full report at Codecov.
|
Can you add some tests? |
I think that we should really handle the www.example.com cases. It shouldn't be too hard to just add http:// as necessary. |
I deal with a lot of hostnames, so linking anything that starts with www (but then not any other hostname) doesn't feel ideal and also feels inconsistent. Having a list of hostnames like www.example.com Where some get automatically turned into a link and the others don't can seem a bit odd. I understand this probably isn't the most common use case, but requiring http|https also gives people a good and obvious option for being specific when they want to generate a link or not, which I think is nice bonus. I see both sides for sure and can also see that github also has similar behavior people might be used to, but requiring http|https would create a much more intentional situation where gitea would never do the undesirable thing when creating a link. Thanks for the feedback! |
Hmm. I guess leaving this in a broken state is worse than useless so I'll approve this and we can think about adding back in the other support if people want. |
OK cool! Agree this definitely needs some comprehensive tests so I'll look into that aspect now |
Existing code comments suggest this should only match http/https links but it
matches anything starting with www as well (and creates broken links as
a result). Change behavior of regex to match what appears to be the
Intended behavior. This is related to #6146