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

Does not cut links that end with non-latin symbols based on domain correctly #278

Open
kibertoad opened this issue Jun 20, 2019 · 4 comments

Comments

@kibertoad
Copy link

kibertoad commented Jun 20, 2019

Once upon a time there was this issue reported in remarkable: jonschlinkert/remarkable#51

Fix worked just fine up to Autolinker version 1.4.1.
On 1.4.2+ the non-latin part was once again included together with the latin domain in parsed url. Most likely this is related to #201 being merged.

My question is this: would you consider that a regression or breaking change from autolinker side? Or previous behaviour was wrong and current one is preferable?

Commit with fix for ease of reference (illustrates what autolinker API is used, and what is expected outcome): jonschlinkert/remarkable@719d4c1

Newest version generates this: -<p><a href="http://www.example.org版权所有">www.example.org版权所有</a></p>

@gregjacobs
Copy link
Owner

Hey @kibertoad, interesting issue. Seems like a regression to me that it includes the non-latin symbols, and it looks like it doesn't link it at all if not prefixed by http or www. I see the following behavior at the moment:

link('http://www.example.org版权所有')  // <a href="http://www.example.org版权所有">example.org版权所有</a>
link('www.example.org版权所有')         // <a href="http://www.example.org版权所有">example.org版权所有</a>
link('example.org版权所有')             // example.org版权所有 (no link generated)

Do you think the correct behavior would be the following?

link('http://www.example.org版权所有')  // <a href="http://www.example.org">example.org</a>版权所有
link('www.example.org版权所有')         // <a href="http://www.example.org">example.org</a>版权所有
link('example.org版权所有')             // <a href="http://www.example.org">example.org</a>版权所有

@kibertoad
Copy link
Author

Yes, that looks correct. Thank you for the quick response!

@TrySound
Copy link
Contributor

TrySound commented Aug 4, 2019

Hi @gregjacobs. Do you have some time to take a look at this issue?

@TrySound
Copy link
Contributor

TrySound commented Aug 4, 2019

I see in this test that such behaviour is expected.
https://github.com/gregjacobs/Autolinker.js/blob/master/tests/autolinker-url.spec.ts#L201

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

3 participants