Opened 4 years ago
Last modified 4 years ago
#32874 closed New feature
URLValidator is not validating schema relative URLs — at Version 1
| Reported by: | Maciej Strömich | Owned by: | nobody |
|---|---|---|---|
| Component: | Core (Other) | Version: | 3.2 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Based on rfc1808#section-2.4.3 a valid schema relative URL is the one starting with //
URLValidator is not validating such urls.
>>> from django.core.validators import URLValidator
>>> value = '//example.com'
>>> URLValidator().__call__(value)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/opt/venv/lib/python3.8/site-packages/django/core/validators.py", line 110, in __call__
raise ValidationError(self.message, code=self.code, params={'value': value})
django.core.exceptions.ValidationError: ['Enter a valid URL.']
Note:
See TracTickets
for help on using tickets.
formatting