Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Question] validators.url() fails for valid URLs but has a & followed by a ? #406

Open
thakkerurvish opened this issue Oct 14, 2024 · 1 comment

Comments

@thakkerurvish
Copy link

thakkerurvish commented Oct 14, 2024

Description:

The validators.url() function is returning a ValidationError for a URL that is valid on a browser. However, it might not comply the standards.

The issue in above URL is, it has a & immediately followed by ?, which does not comply the standards but is a valid URL.

Steps to Reproduce:

  • Install the latest version of the validators library
  • Run the following code:
import validators

url = "https://www.cheapoair.com/air/listing?&d1=SJC&r1=AMD&dt1=11/04/2024&d2=AMD&r2=SJC&dt2=11/16/2024&tripType=ROUNDTRIP&cl=ECONOMY&ad=1&se=0&ch=0&infs=0&infl=0"

result = validators.url(url)
print(result)

Expected Behavior:

  • The function should return True, indicating a valid URL.

Actual Behavior:

  • The function returns a ValidationError.

Cheapoair is a popular website and some other travel websites I obeserved have this issue as well. Should this be considered as bug and be fixed it. Or is this an expected behavior flagging this URLs.

@yozachar
Copy link
Collaborator

Have you tried strict_query parameter?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants