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

URI format to restrictive #60

Open
zoellner opened this issue Apr 27, 2022 · 4 comments
Open

URI format to restrictive #60

zoellner opened this issue Apr 27, 2022 · 4 comments

Comments

@zoellner
Copy link

URIs should be allowed to have characters outside of a-zA-z, e.g. ñ and other non-ascii characters.

@bcomnes
Copy link

bcomnes commented Jan 25, 2023

Running into a situation where internet archive URLs are not allowed. The depreciated URL format seems to be more flexible.

@bcomnes
Copy link

bcomnes commented Jan 25, 2023

Running URLs through new URL and then taking the toString() results properly escapes these URLs to pass validation, however it does make them less readable.

@nobari
Copy link

nobari commented Nov 17, 2024

URI should allow non-ASCII characters. For time being our workaround is to creates a custom URI validator that uses the built-in URL constructor, which is more lenient with non-ASCII characters:

ajv.addFormat('uri', {
  validate: (str: string) => {
    try {
      new URL(str)
      return true
    } catch {
      return false
    }
  },
})

@bcomnes
Copy link

bcomnes commented Nov 17, 2024

URI should allow non-ASCII characters. For time being our workaround is to creates a custom URI validator that uses the built-in URL constructor, which is more lenient with non-ASCII characters:

Check out canParse https://developer.mozilla.org/en-US/docs/Web/API/URL/canParse_static

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

No branches or pull requests

3 participants