Re: [Django] #15879: multipart/form-data filename="" not handled as file

12 views
Skip to first unread message

Django

unread,
Mar 8, 2025, 4:22:31 AM3/8/25
to django-...@googlegroups.com
#15879: multipart/form-data filename="" not handled as file
-------------------------------------+-------------------------------------
Reporter: j@… | Owner: Hridesh
| MG
Type: Bug | Status: assigned
Component: File | Version: 1.3
uploads/storage |
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 Hridesh MG):

* needs_tests: 1 => 0
* owner: nobody => Hridesh MG
* status: new => assigned

Comment:

Can confirm that this is still reproducible, I've written the following
test that can be added to `tests/requests_tests.py`

{{{#!python
def test_POST_multipart_with_empty_filename(self):
payload = FakePayload(
"\r\n".join(
[
f"--{BOUNDARY}",
'Content-Disposition: form-data; name="File";
filename=""',
"Content-Type: application/octet-stream",
"",
"Framework,ID",
"Django,1",
"Flask,2",
f"--{BOUNDARY}--",
]
)
)
request = WSGIRequest(
{
"REQUEST_METHOD": "POST",
"CONTENT_TYPE": MULTIPART_CONTENT,
"CONTENT_LENGTH": len(payload),
"wsgi.input": payload,
}
)
self.assertEqual(len(request.FILES), 1)
self.assertIsInstance((request.FILES["File"]),
InMemoryUploadedFile)


}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/15879#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 8, 2025, 6:49:08 AM3/8/25
to django-...@googlegroups.com
#15879: multipart/form-data filename="" not handled as file
-------------------------------------+-------------------------------------
Reporter: j@… | Owner: Hridesh
| MG
Type: Bug | Status: assigned
Component: File | Version: 1.3
uploads/storage |
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 Hridesh MG):

[https://github.com/django/django/pull/19239 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/15879#comment:4>

Django

unread,
Mar 8, 2025, 10:32:52 AM3/8/25
to django-...@googlegroups.com
#15879: multipart/form-data filename="" not handled as file
-------------------------------------+-------------------------------------
Reporter: j@… | Owner: Hridesh
| MG
Type: Bug | Status: assigned
Component: File | Version: 1.3
uploads/storage |
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 Jacob Walls):

* needs_better_patch: 1 => 0

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

Django

unread,
Apr 27, 2025, 6:47:43 AM4/27/25
to django-...@googlegroups.com
#15879: multipart/form-data filename="" not handled as file
-------------------------------------+-------------------------------------
Reporter: j@… | Owner: Hridesh
| MG
Type: Bug | Status: assigned
Component: File | Version: 1.3
uploads/storage |
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 David Smith):

* needs_better_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/15879#comment:6>
Reply all
Reply to author
Forward
0 new messages