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

URLs preceded with text are not linked correctly #159

Closed
AlvaroIHS opened this issue May 12, 2016 · 8 comments
Closed

URLs preceded with text are not linked correctly #159

AlvaroIHS opened this issue May 12, 2016 · 8 comments

Comments

@AlvaroIHS
Copy link

asdasdahttp://example.com will link like:

<a href="asdasdahttp://example.com/" target="_blank">asdasdahttp://example.com</a>

It should link:

asdasda<a href="http://example.com/" target="_blank">http://example.com</a>

@jasongrishkoff
Copy link

Running into the same issue.

@gregjacobs
Copy link
Owner

Hey guys. So autolinker tries to link many schemes other than just http: or https:. That's why it is linking "too much" in this case.

What are some inputs from users that you are getting which exhibit this problem though?

@jasongrishkoff
Copy link

jasongrishkoff commented Nov 25, 2016

Something as simple as "hahahttp://www.submithub.com" was getting messed up. I'm using a bit of a hack solution to get around it:

var text = "hahahttp://www.indieshuffle.com"
var text = text.replace("http"," http") //forcing a space to the start
var text = Autolinker.link(text)

Seems to pretty much do the trick.

@gregjacobs
Copy link
Owner

Ok, interesting. I'm thinking maybe the code should make an exception for this particular case then. If it finds http or https at the end of the scheme string, it should assume that the scheme is http or https and remove anything that comes before it.

Will work on this when I get a chance maybe next weekend, or other pull requests are definitely welcome!

@ivpusic
Copy link

ivpusic commented Jul 4, 2017

@gregjacobs any updates here?

@olafleur
Copy link
Collaborator

olafleur commented Jul 8, 2017

@ivpusic Not for the moment, but you are more than welcome to submit a pull request! :)

@gregjacobs
Copy link
Owner

Going through old issues, and working on this now!

adamdavidcole pushed a commit to adamdavidcole/Autolinker.js that referenced this issue Jun 7, 2019
gregjacobs added a commit that referenced this issue Jul 31, 2019
…eceeding

Fix for URLs preceded with text are not linked correctly #159
@gregjacobs
Copy link
Owner

Fixed with #275

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants