[Django] #31548: URLValidator is expected to raise ValidationError for empty string or not string at all.

24 views
Skip to first unread message

Django

unread,
May 7, 2020, 11:36:23 AM5/7/20
to django-...@googlegroups.com
#31548: URLValidator is expected to raise ValidationError for empty string or not
string at all.
----------------------------------------------+------------------------
Reporter: Vasiliy Bondarenko | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 3.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
----------------------------------------------+------------------------
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)

}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/31548>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 8, 2020, 12:20:13 AM5/8/20
to django-...@googlegroups.com
#31548: URLValidator is expected to raise ValidationError for empty string or not
string at all.
------------------------------------+--------------------------------------
Reporter: Vasiliy Bondarenko | Owner: Yash Saini
Type: Bug | Status: assigned
Component: Core (Other) | Version: 3.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------------+--------------------------------------
Changes (by Yash Saini):

* owner: nobody => Yash Saini
* status: new => assigned
* component: Uncategorized => Core (Other)
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/31548#comment:1>

Django

unread,
May 8, 2020, 12:43:06 AM5/8/20
to django-...@googlegroups.com
#31548: URLValidator crashes on None, empty strings, and non-strings.

------------------------------------+--------------------------------------
Reporter: Vasiliy Bondarenko | Owner: Yash Saini
Type: Bug | Status: assigned
Component: Core (Other) | Version: 3.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------------+--------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/31548#comment:2>

Django

unread,
May 8, 2020, 5:08:28 AM5/8/20
to django-...@googlegroups.com
#31548: URLValidator crashes on None, empty strings, and non-strings.
------------------------------------+--------------------------------------
Reporter: Vasiliy Bondarenko | Owner: Yash Saini
Type: Bug | Status: assigned
Component: Core (Other) | Version: 3.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------------+--------------------------------------
Changes (by Yash Saini):

* has_patch: 0 => 1


Comment:

https://github.com/django/django/pull/12877 PR

--
Ticket URL: <https://code.djangoproject.com/ticket/31548#comment:3>

Django

unread,
May 8, 2020, 2:46:18 PM5/8/20
to django-...@googlegroups.com
#31548: URLValidator crashes on non-strings.
-------------------------------------+-------------------------------------

Reporter: Vasiliy Bondarenko | Owner: Yash
| Saini
Type: Bug | Status: assigned
Component: Core (Other) | Version: 3.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/31548#comment:4>

Django

unread,
May 8, 2020, 4:13:48 PM5/8/20
to django-...@googlegroups.com
#31548: URLValidator crashes on non-strings.
-------------------------------------+-------------------------------------
Reporter: Vasiliy Bondarenko | Owner: Yash
| Saini
Type: Bug | Status: closed

Component: Core (Other) | Version: 3.0
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"ccb1cfb64e919e163c51995ed99bff3c92d7d006" ccb1cfb]:
{{{
#!CommitTicketReference repository=""
revision="ccb1cfb64e919e163c51995ed99bff3c92d7d006"
Fixed #31548 -- Fixed URLValidator crash on non-strings.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/31548#comment:5>

Reply all
Reply to author
Forward
0 new messages