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

Bug: tildes in URLs cause the URL to be broken #1084

Closed
1 task done
dawbarton opened this issue May 1, 2024 · 2 comments · Fixed by #1095
Closed
1 task done

Bug: tildes in URLs cause the URL to be broken #1084

dawbarton opened this issue May 1, 2024 · 2 comments · Fixed by #1095
Assignees
Labels
bug Something isn't working reproducible resolution/update-made A change has been made that should resolve this issue or request

Comments

@dawbarton
Copy link

  • I have verified that I am on the latest version of the Linter

Describe the Bug

Whenever the linter encounters a URL with a tilde in, it breaks the URL. It doesn't seem to recognise that ~ is a valid character in a URL.

How to Reproduce

Steps to reproduce the behavior:

  1. Put <https://some.website/~username/> into a file
  2. Run the linter
  3. The result is <<https://some.website/>~username/> when the URL should have been left untouched.
@dawbarton dawbarton added the bug Something isn't working label May 1, 2024
@dawbarton
Copy link
Author

Looks like a regex is incorrect

export const urlRegex = /(?:(?:(?:[a-z]+:)?\/\/)|www\.)(?:localhost|(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?:(?:[a-fA-F\d]{1,4}:){7}(?:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,2}|:)|(?:[a-fA-F\d]{1,4}:){4}(?:(?::[a-fA-F\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,3}|:)|(?:[a-fA-F\d]{1,4}:){3}(?:(?::[a-fA-F\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,4}|:)|(?:[a-fA-F\d]{1,4}:){2}(?:(?::[a-fA-F\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,5}|:)|(?:[a-fA-F\d]{1,4}:){1}(?:(?::[a-fA-F\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,6}|:)|(?::(?:(?::[a-fA-F\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,7}|:)))(?:%[0-9a-zA-Z]{1,})?|(?:(?:[a-z0-9][-_]*)*[a-z0-9]+)(?:\.(?:[a-z0-9]-*)*[a-z0-9]+)*(?:\.(?:[a-z]{2,})))(?::\d{2,5})?(?:(?:[/?#][a-z0-9-_%/&=?$.+!*(,#@]*[a-z0-9-%_/$+!*(,])|[/])?/gi;

@pjkaufman pjkaufman self-assigned this Jun 1, 2024
@pjkaufman pjkaufman moved this from Backlog to In Progress in Obsidian Linter Jun 1, 2024
@github-project-automation github-project-automation bot moved this from In Progress to In Next Release in Obsidian Linter Jun 1, 2024
@pjkaufman
Copy link
Collaborator

The change for this should now be on master and go out in the next release. Please let us know if it is not working in either place.

@pjkaufman pjkaufman added the resolution/update-made A change has been made that should resolve this issue or request label Jun 17, 2024
@pjkaufman pjkaufman moved this from In Next Release to Released in Obsidian Linter Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working reproducible resolution/update-made A change has been made that should resolve this issue or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants