What kind of issue is this? (put 'x' between the square brackets)
-
[ ] Question. This issue tracker is not the place for questions. If you want to ask how to do
something, or to understand why something isn't working the way you expect it to, use
http://stackoverflow.com/questions/ask .
Provide working code, starting from http://codepen.io/marcandre/pen/jqbzyN?editors=101.
We monitor the tag parsley.js
.
-
[x] Bug report. If you’ve found a bug, you must provide a minimal example in a CodePen,
starting from http://codepen.io/marcandre/pen/jqbzyN?editors=101 .
-
[ ] Feature Request. Make sure there's no good way to do what you want first;
consider asking on http://stackoverflow.com/questions/ask first.
I am having problems validating a URL containing an underscore, they are coming back as invalid according to Parsley.
I have checked the regex Parsley uses: https://github.com/guillaumepotier/Parsley.js/blob/master/src/parsley/validator_registry.js#L53
It does appear that it disallows an underscore.
I went on to try to find out what the deal with underscores in URLs is, and I have not been able to find an absolute clear answer:
- RFC1738 says they are not allowed
- The URI spec says that they are allowed
- In various places I have read that hostnames do not allow underscores but domain names do.
The conclusion is that it's a mess, and I genuinely have no idea if they are valid, after spending most of a day trying to find out.
But, there is a more practical issue, which is that nonetheless URLs with underscores do exist, and my browser will resolve them, so that seems like a fairly good test that they are allowed, if not in spec, then at least "in the wild". Here's an example of such a URL: https://imuk_eng.pnzgu.ru/
So, I need to get my form to permit them, which it currently doesn't.
The best answer is that Parsley's type=url
validator would allow underscores in URLs, and I don't know how feasible that is.
The second best answer is that I could override the Parsley URL regex with my own weakened version which allows underscores. I haven't found a clean way to do that yet, short or removing and then replacing the type
validator with my own one, which I don't want to do, as I think I'd need to copy a lot of Parsley internal code.
Is there a way to replace https://github.com/guillaumepotier/Parsley.js/blob/master/src/parsley/validator_registry.js#L31 at runtime?
Thanks!