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

URL formatting truncates domain names with numbers > 3 and hyphens #36

Closed
dragonman225 opened this issue Oct 1, 2022 · 0 comments · Fixed by #42
Closed

URL formatting truncates domain names with numbers > 3 and hyphens #36

dragonman225 opened this issue Oct 1, 2022 · 0 comments · Fixed by #42

Comments

@dragonman225
Copy link

Hi, I'm the author of Jade (https://dragonman225.js.org/jade.html). Thanks for including my work in the collection!

I noticed a weird behavior of the formatting of my domain name, though.
Screen Shot 2022-10-01 at 2 06 33 PM

As shown in the screenshot, the parts after the second "2" is missing.

At first, I thought it was because of the length, but then I saw there were even longer domain names like "mischief.findmysoft.com", so I looked into the code and found

.match(/[a-z1-3.]*/g)[0] + "" //capture just the domain and nothing after

The regex only keeps numbers 1, 2, and 3, which would truncate my domain name as soon as it sees the "5".

Are there any reasons behind this design? Thinking about it more, I could see it would also truncate domain names with hyphens, or even international domain names containing Unicode.

If a filter is necessary, maybe changing the regex to /[a-z0-9\-.]*/g would be a good start? It would support most domain names, while ignoring rarely used Unicode ones for now.

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

Successfully merging a pull request may close this issue.

1 participant