-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot save LDAP settings if Server URI ends with custom domain(i.e. not ending with com, net, org, etc) #3646
Comments
the error occurs if a number is present anywhere in the top-level domain portion of the url, e.g. .so3, s3o, 3so, etc. the full url is validated using the built-in django URLValidator, which checks against a pre-defined reg expression to make sure the string looks like a valid url one workaround would be to replace any given url top level domain portion with something we know works, e.g. replace and sending that into the run_validations() method. That way it checks the validity of the rest of the url and url structure without getting hung up on the top level domain another option is to write a custom regex and send that into the validator or we can simply disallow non-conventional urls and give the user a more detailed error message instead of the generic 400 or, we can remove this particular URLValidator altogether so the check never occurs. |
here is the regex is checks against by default https://github.com/django/django/blob/55b68de643b5c2d5f0a8ea7587ab3b2966021ccc/django/core/validators.py#L89 |
…ustom regex that will be used to validate a URI provided by users. The URI is eventually passed through a django class, URLValidator. This class has a default regex that does not accept numbers in the top level domain. The custom regex, which is passed into URLValidator via **kwargs, simply offers number capabilites for the top level domain portion of the full url. This is a bug fix related to issue ansible#3646.
- API error if LDAPServerFieldURI contains a number in the top level domain - Add custom regex in LDAPServerFieldURI class that is passed to django URLValidator - The custom regex allows for numbers to be present in the top level domain - Unit tests check that valid URIs pass through URLValidator, and that invalid URIs raise the correct exception - Related to issue ansible#3646
- API error if LDAPServerURIField contains a number in the top level domain - Add custom regex in LDAPServerURIField class that is passed to django URLValidator - The custom regex allows for numbers to be present in the top level domain - Unit tests check that valid URIs pass through URLValidator, and that invalid URIs raise the correct exception - Related to issue ansible#3646
- Bug: API error if LDAPServerURIField contains a number in the top level domain - Add custom regex in LDAPServerURIField class that is passed to django URLValidator - The custom regex allows for numbers to be present in the top level domain - Unit tests check that valid URIs pass through URLValidator, and that invalid URIs raise the correct exception - Related to issue ansible#3646
Tested out with a variety of different URIs, I'm happy with the unit test coverage that was added. Thanks! |
ISSUE TYPE
COMPONENT NAME
SUMMARY
ENVIRONMENT
STEPS TO REPRODUCE
EXPECTED RESULTS
It should save the config
ACTUAL RESULTS
Error message stating: Failed to save settings. Returned status: 400
The field then display : Enter a valid URL
But the url is valid, for an internal domain.
ADDITIONAL INFORMATION
The text was updated successfully, but these errors were encountered: