[Django] #21033: Uploaded file's name truncates to 255 not in all cases

8 views
Skip to first unread message

Django

unread,
Sep 4, 2013, 12:10:10 PM9/4/13
to django-...@googlegroups.com
#21033: Uploaded file's name truncates to 255 not in all cases
--------------------------------------+--------------------
Reporter: homm | Owner: nobody
Type: Bug | Status: new
Component: File uploads/storage | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 0 | UI/UX: 0
--------------------------------------+--------------------
If uploaded file name has very-ver long extension, it not truncates to 255
chars.

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

Django

unread,
Sep 4, 2013, 12:11:54 PM9/4/13
to django-...@googlegroups.com
#21033: Uploaded file's name truncates to 255 not in all cases
-------------------------------------+-------------------------------------

Reporter: homm | Owner: nobody
Type: Bug | Status: new
Component: File | Version: master
uploads/storage | Resolution:
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by homm):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

https://github.com/django/django/pull/1548

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

Django

unread,
Sep 5, 2013, 11:05:38 AM9/5/13
to django-...@googlegroups.com
#21033: Uploaded file's name truncates to 255 not in all cases
-------------------------------------+-------------------------------------

Reporter: homm | Owner: nobody
Type: Bug | Status: new
Component: File | Version: master
uploads/storage | Resolution:
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by timo):

Changing the file extension seems like it may not be a good idea. Did you
run into a problem with this?

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

Django

unread,
Sep 5, 2013, 11:16:57 AM9/5/13
to django-...@googlegroups.com
#21033: Uploaded file's name truncates to 255 not in all cases
-------------------------------------+-------------------------------------

Reporter: homm | Owner: nobody
Type: Bug | Status: new
Component: File | Version: master
uploads/storage | Resolution:
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by homm):

What do you mean by "extension"? This patch truncate sequence of chars
after last dot longer then 255 chars. Is it can be called "extension"? I
do not think so.

I see problem there: malefactor can send file with name longer then 255
chars. I don't know, is it problem does matter at all. If it does matter
let's do strict check. If it is doesn't matter, let's remove this check at
all.

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

Django

unread,
Sep 6, 2013, 10:58:49 AM9/6/13
to django-...@googlegroups.com
#21033: Uploaded file's name truncates to 255 not in all cases
--------------------------------------+------------------------------------

Reporter: homm | Owner: nobody
Type: Bug | Status: new
Component: File uploads/storage | Version: master
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 sduveen):

* stage: Unreviewed => Accepted


Comment:

I don't think 'file extension' can reasonably describe anything that is
over 255 chars after a dot. Patch and test look good. (refering to
https://github.com/django/django/pull/1548/files#L0L45)

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

Django

unread,
Sep 6, 2013, 11:02:39 AM9/6/13
to django-...@googlegroups.com
#21033: Uploaded file's name truncates to 255 not in all cases
-------------------------------------+-------------------------------------

Reporter: homm | Owner: nobody
Type: Bug | Status: new
Component: File | Version: master
uploads/storage | Resolution:
Severity: Normal | Triage Stage: Ready for
Keywords: | checkin

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

* stage: Accepted => Ready for checkin


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

Django

unread,
Sep 6, 2013, 12:20:32 PM9/6/13
to django-...@googlegroups.com
#21033: Uploaded file's name truncates to 255 not in all cases
--------------------------------------+------------------------------------

Reporter: homm | Owner: nobody
Type: Bug | Status: new
Component: File uploads/storage | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by bmispelon):

* cc: bmispelon@… (added)
* needs_better_patch: 0 => 1
* stage: Ready for checkin => Accepted


Comment:

I think the tests should be moved to `file_uploads/`, next to the one that
tests the truncating functionality [1].

I would also rewrite them to immitate the `test_filename_overflow` test,
which I think tests the issue more accurately: we want to make sure that
an uploaded file doesn't have a name longer than 255 characters.

Thanks.

[1]
https://github.com/django/django/blob/master/tests/file_uploads/tests.py#L168

--
Ticket URL: <https://code.djangoproject.com/ticket/21033#comment:6>

Django

unread,
Sep 7, 2013, 5:06:05 AM9/7/13
to django-...@googlegroups.com
#21033: Uploaded file's name truncates to 255 not in all cases
--------------------------------------+------------------------------------

Reporter: homm | Owner: nobody
Type: Bug | Status: new
Component: File uploads/storage | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by homm):

I update patch and move tests in file_uploads.

--
Ticket URL: <https://code.djangoproject.com/ticket/21033#comment:7>

Django

unread,
Sep 9, 2013, 7:56:27 PM9/9/13
to django-...@googlegroups.com
#21033: Uploaded file's name truncates to 255 not in all cases
--------------------------------------+------------------------------------
Reporter: homm | Owner: nobody
Type: Bug | Status: closed

Component: File uploads/storage | Version: master
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Baptiste Mispelon <bmispelon@…>):

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


Comment:

In [changeset:"7008ed61c519f93a9b6c5c547ad718ad2deb959b"]:
{{{
#!CommitTicketReference repository=""
revision="7008ed61c519f93a9b6c5c547ad718ad2deb959b"
Fixed #21033 -- Fixed uploaded filenames not always being truncated to 255
characters
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/21033#comment:8>

Reply all
Reply to author
Forward
0 new messages