Opened 5 years ago
Closed 5 years ago
#31548 closed Bug (fixed)
URLValidator crashes on non-strings.
Reported by: | Vasiliy Bondarenko | Owned by: | Yash Saini |
---|---|---|---|
Component: | Core (Other) | Version: | 3.0 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
URLValidator is expected to raise ValidationError for empty string, instead it fails on .split
statement with general error:
AttributeError: 'NoneType' object has no attribute 'split'
or
AttributeError: 'int' object has no attribute 'split'
etc.
in django/core/validators.py
def __call__(self, value): # Check first if the scheme is valid scheme = value.split('://')[0].lower() if scheme not in self.schemes: raise ValidationError(self.message, code=self.code)
Change History (5)
comment:1 by , 5 years ago
Component: | Uncategorized → Core (Other) |
---|---|
Owner: | changed from | to
Status: | new → assigned |
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 5 years ago
Summary: | URLValidator is expected to raise ValidationError for empty string or not string at all. → URLValidator crashes on None, empty strings, and non-strings. |
---|
comment:3 by , 5 years ago
Has patch: | set |
---|
comment:4 by , 5 years ago
Summary: | URLValidator crashes on None, empty strings, and non-strings. → URLValidator crashes on non-strings. |
---|---|
Triage Stage: | Accepted → Ready for checkin |
Note:
See TracTickets
for help on using tickets.
https://github.com/django/django/pull/12877 PR