Skip to content

Conversation

@darkdragon-001
Copy link
Contributor

Fragments should allow a specific set of characters (see https://stackoverflow.com/a/26119120/3779655).

See #299 (comment)

@yozachar yozachar self-requested a review October 4, 2023 07:26
@yozachar yozachar self-assigned this Oct 4, 2023
@yozachar
Copy link
Collaborator

yozachar commented Oct 4, 2023

@darkdragon-001, looks like that regex didn't hash out properly, can you fix it?


run log

=========================== short test summary info ============================
FAILED tests/test_url.py::test_returns_true_on_valid_url[http://foo.com/blah_(wikipedia)#cite-1] - AssertionError: assert ValidationError(func=url, args={'reason': 'bad character range @-. at position 16', 'value': 'http://foo.com/blah_(wikipedia)#cite-1'})
 +  where ValidationError(func=url, args={'reason': 'bad character range @-. at position 16', 'value': 'http://foo.com/blah_(wikipedia)#cite-1'}) = url('http://foo.com/blah_(wikipedia)#cite-1')
FAILED tests/test_url.py::test_returns_true_on_valid_url[http://foo.com/blah_(wikipedia)_blah#cite-1] - AssertionError: assert ValidationError(func=url, args={'reason': 'bad character range @-. at position 16', 'value': 'http://foo.com/blah_(wikipedia)_blah#cite-1'})
 +  where ValidationError(func=url, args={'reason': 'bad character range @-. at position 16', 'value': 'http://foo.com/blah_(wikipedia)_blah#cite-1'}) = url('http://foo.com/blah_(wikipedia)_blah#cite-1')
FAILED tests/test_url.py::test_returns_true_on_valid_url[http://code.google.com/events/#&product=browser] - AssertionError: assert ValidationError(func=url, args={'reason': 'bad character range @-. at position 16', 'value': 'http://code.google.com/events/#&product=browser'})
 +  where ValidationError(func=url, args={'reason': 'bad character range @-. at position 16', 'value': 'http://code.google.com/events/#&product=browser'}) = url('http://code.google.com/events/#&product=browser')
FAILED tests/test_url.py::test_returns_true_on_valid_url[https://exchange.jetswap.finance/#/swap] - AssertionError: assert ValidationError(func=url, args={'reason': 'bad character range @-. at position 16', 'value': 'https://exchange.jetswap.finance/#/swap'})
 +  where ValidationError(func=url, args={'reason': 'bad character range @-. at position 16', 'value': 'https://exchange.jetswap.finance/#/swap'}) = url('https://exchange.jetswap.finance/#/swap')
FAILED tests/test_url.py::test_returns_true_on_valid_url[https://www.foo.com/bar#/baz/test] - AssertionError: assert ValidationError(func=url, args={'reason': 'bad character range @-. at position 16', 'value': 'https://www.foo.com/bar#/baz/test'})
 +  where ValidationError(func=url, args={'reason': 'bad character range @-. at position 16', 'value': 'https://www.foo.com/bar#/baz/test'}) = url('https://www.foo.com/bar#/baz/test')
FAILED tests/test_url.py::test_returns_true_on_valid_url[https://matrix.to/#/!BSqRHgvCtIsGittkBG:talk.puri.sm/$1551464398853539kMJNP:matrix.org?via=talk.puri.sm&via=matrix.org&via=disroot.org] - AssertionError: assert ValidationError(func=url, args={'reason': 'bad character range @-. at position 16', 'value': 'https://matrix.to/#/!BSqRHgvCtIsGittkBG:talk.puri.sm/$1551464398853539kMJNP:matrix.org?via=talk.puri.sm&via=matrix.org&via=disroot.org'})
 +  where ValidationError(func=url, args={'reason': 'bad character range @-. at position 16', 'value': 'https://matrix.to/#/!BSqRHgvCtIsGittkBG:talk.puri.sm/$1551464398853539kMJNP:matrix.org?via=talk.puri.sm&via=matrix.org&via=disroot.org'}) = url('https://matrix.to/#/!BSqRHgvCtIsGittkBG:talk.puri.sm/$1551464398853539kMJNP:matrix.org?via=talk.puri.sm&via=matrix.org&via=disroot.org')
======================== 6 failed, 555 passed in 0.87s =========================

Copy link
Collaborator

@yozachar yozachar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thanks for the PR!

@yozachar yozachar merged commit 15984e8 into python-validators:master Oct 5, 2023
@yozachar yozachar added maintenance PR: Alters existing source code bugfix PR: Bug is fixed labels Oct 5, 2023
@yozachar yozachar linked an issue Oct 5, 2023 that may be closed by this pull request
@darkdragon-001 darkdragon-001 deleted the fix-fragment branch October 5, 2023 19:44
@yozachar yozachar linked an issue Oct 9, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix PR: Bug is fixed maintenance PR: Alters existing source code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

URL validator fails is dollar sign '$' is used in the query parameters url raising validation error on a valid url

2 participants