Skip to content
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

Dash in URL breaks hyperlink parsing #3095

Closed
svarlamov opened this issue Dec 5, 2017 · 4 comments
Closed

Dash in URL breaks hyperlink parsing #3095

svarlamov opened this issue Dec 5, 2017 · 4 comments

Comments

@svarlamov
Copy link
Contributor

svarlamov commented Dec 5, 2017

Description

When posting an issue by cut-n-pasting a URL like https://example.com/something/my-link the URL parsing works and I get a pretty hyperlink after posting. However, this url https://sample.example.com/:i:/p/foobar/helloworld-foo?abc=123 breaks. Ie., the link is only the https://sample.example.com/:i:/p/foobar/helloworld part, whereas -foo?abc=123 just looks like normal text and when I click on the part that got recognized as a link, it directs me without the -foo?abc=123 part -- which is not where I wanted to go!

I have this problem quite often when posting links to screenshots in Gitea (because the image upload is very painful, ref #3032)... But even now that I'm posting URLs, it's still not happy... 😢

Screenshots

image

@lukewatts
Copy link

Is there any update on if this is being looked into? Or when a fix might be implemented?

@lafriks
Copy link
Member

lafriks commented Jan 16, 2018

@lukewatts This PR #3354 could possible solve this

@stale
Copy link

stale bot commented Feb 8, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale stale bot added the issue/stale label Feb 8, 2019
@lunny
Copy link
Member

lunny commented Feb 9, 2019

Since #3354 merged, I'll close this one. Please feel free to reopen it.

@lunny lunny closed this as completed Feb 9, 2019
mrsdizzie added a commit to mrsdizzie/gitea that referenced this issue Mar 7, 2019
Rather than maintaining a complicated regex to match URLs for
autolinking, gitea can use this existing go library that takes care of
the matching with very little code change to gitea itself. After
spending a while trying to find the perfect regex for all cases this library
still works better as it is more flexible than a single regex ever will be.

This will also fix the following issues: go-gitea#5844 go-gitea#3095 go-gitea#3381

This passes all our current tests and I've added new ones mentioned in
those issues as well.
techknowlogick pushed a commit that referenced this issue Mar 7, 2019
* Replace linkRegex with xurls library

Rather than maintaining a complicated regex to match URLs for
autolinking, gitea can use this existing go library that takes care of
the matching with very little code change to gitea itself. After
spending a while trying to find the perfect regex for all cases this library
still works better as it is more flexible than a single regex ever will be.

This will also fix the following issues: #5844 #3095 #3381

This passes all our current tests and I've added new ones mentioned in
those issues as well.

* Use xurls.StrictMatchingScheme instead of xurls.Strict

This is much faster and we only care about https? links to preserve
existing behavior.
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants