URL validator does not accept fragments
See original GitHub issueA URL with a fragment fails to validate:
>>> from strictyaml import Map, Url, load
>>> schema = Map({"url": Url()})
>>>
>>> load("url: https://example.com/bla", schema)
YAML({'url': 'https://example.com/bla'})
>>>
>>> load("url: https://example.com/bla#header", schema)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/cgrigis/C4DT/Projects/strictyaml/strictyaml/parser.py", line 318, in load
return generic_load(yaml_string, schema=schema, label=label)
File "/home/cgrigis/C4DT/Projects/strictyaml/strictyaml/parser.py", line 296, in generic_load
return schema(YAMLChunk(document, label=label))
File "/home/cgrigis/C4DT/Projects/strictyaml/strictyaml/validators.py", line 17, in __call__
self.validate(chunk)
File "/home/cgrigis/C4DT/Projects/strictyaml/strictyaml/compound.py", line 165, in validate
value.process(self._validator_dict[yaml_key.scalar](value))
File "/home/cgrigis/C4DT/Projects/strictyaml/strictyaml/scalar.py", line 27, in __call__
return YAML(chunk, validator=self)
File "/home/cgrigis/C4DT/Projects/strictyaml/strictyaml/representation.py", line 63, in __init__
self._value = validator.validate(value)
File "/home/cgrigis/C4DT/Projects/strictyaml/strictyaml/scalar.py", line 30, in validate
return self.validate_scalar(chunk)
File "/home/cgrigis/C4DT/Projects/strictyaml/strictyaml/scalar.py", line 128, in validate_scalar
self._matching_message, "found non-matching string"
File "/home/cgrigis/C4DT/Projects/strictyaml/strictyaml/yamllocation.py", line 47, in expecting_but_found
self,
strictyaml.exceptions.YAMLValidationError: when expecting a url
found non-matching string
in "<unicode string>", line 1, column 1:
url: https://example.com/bla#header
^ (line: 1)
Probably related to 5beb1eaeb9fa2c23adc9a548a164e4d539f2acfc… it seems the new regex from https://urlregex.com/ does not cover fragments?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Why UrlValidator do not work for some of my Urls?
Note that this only works if your URL is already encoded! URI only accepts URLs with encoded query parameters, else it will throw...
Read more >Not possible to add link with fragment identifier #1049 - GitHub
First step is probably to figure out whether it's enough to change the existing link choosers' validation and UI (#1049 (comment)) to support...
Read more >Illegal character in fragment: “#” is not allowed.
An <a> element has been found with an invalid href attribute, containing more than one # adjacent character. The # is used to...
Read more >UrlValidator (Wicket Parent 9.13.0-SNAPSHOT API)
NO_FRAGMENT- [FALSE] : By default fragments are allowed. If this option is included then fragments are flagged as illegal. ALLOW_ALL_SCHEMES - [FALSE] :...
Read more >Board URL fragments do not allow urlencoded symbols - Drupal
Expected behavior I expect that if I enter a legitimate Pinterest board URL, media_entity_pinterest's field formatter will render it.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, I’ll take a look tonight.
On Mon, 31 May 2021, 17:08 cgrigis, @.***> wrote:
Hi,
Sorry I havent been very active on this I’ve had a lot on recently.
That sounds like a good idea though.
On Wed, 23 Feb 2022, 15:29 cgrigis, @.***> wrote: