Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

URL validator does not accept fragments

See original GitHub issue

A URL with a fragment fails to validate:

>>> from strictyaml import Map, Url, load
>>> schema = Map({"url": Url()})
>>> load("url:", schema)
YAML({'url': ''})
>>> load("url:", schema)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/cgrigis/C4DT/Projects/strictyaml/strictyaml/", line 318, in load
    return generic_load(yaml_string, schema=schema, label=label)
  File "/home/cgrigis/C4DT/Projects/strictyaml/strictyaml/", line 296, in generic_load
    return schema(YAMLChunk(document, label=label))
  File "/home/cgrigis/C4DT/Projects/strictyaml/strictyaml/", line 17, in __call__
  File "/home/cgrigis/C4DT/Projects/strictyaml/strictyaml/", line 165, in validate
  File "/home/cgrigis/C4DT/Projects/strictyaml/strictyaml/", line 27, in __call__
    return YAML(chunk, validator=self)
  File "/home/cgrigis/C4DT/Projects/strictyaml/strictyaml/", line 63, in __init__
    self._value = validator.validate(value)
  File "/home/cgrigis/C4DT/Projects/strictyaml/strictyaml/", line 30, in validate
    return self.validate_scalar(chunk)
  File "/home/cgrigis/C4DT/Projects/strictyaml/strictyaml/", line 128, in validate_scalar
    self._matching_message, "found non-matching string"
  File "/home/cgrigis/C4DT/Projects/strictyaml/strictyaml/", line 47, in expecting_but_found
strictyaml.exceptions.YAMLValidationError: when expecting a url
found non-matching string
  in "<unicode string>", line 1, column 1:
     ^ (line: 1)

Probably related to 5beb1eaeb9fa2c23adc9a548a164e4d539f2acfc… it seems the new regex from does not cover fragments?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

crdoconnorcommented, May 31, 2021

Yes, I’ll take a look tonight.

On Mon, 31 May 2021, 17:08 cgrigis, @.***> wrote:

@crdoconnor Any chance to have a quick look at this? Thank you!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe .

crdoconnorcommented, Feb 24, 2022


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:

Hello @crdoconnor , any news on this?

I am not sure that is a reliable source for URL regexes. The one for Python does not handle fragments (as per this issue) nor tildes (as in Comparing it to the ones given for e.g. Perl or PHP, it is certainly not equivalent and more limiting.

Perhaps using (which also relies on a regex) or the urllib.parse module (with its limitations), as suggested here ?

— Reply to this email directly, view it on GitHub, or unsubscribe . You are receiving this because you were mentioned.Message ID: @.***>

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found