Closed Nama closed 8 months ago
I see what you're saying, file.name
is the "filename", but we set it to the form field name. However, I don't see a way to change this. filename
is not a required field in form uploads. File names are "arbitrary", and the file could just have easily actually been called "data"
without an extension already. It seems like this is better reported to the library you're using that expects the filename to be in a specific format. Either they should not be doing that (since names are arbitrary), or offer a way to override whatever it is that they're trying to do.
Yes, they should offer an override. But my point is, this is not true:
It basically behaves like a standard file object you know from Python, with the difference that it also has a save() function that can store the file on the filesystem.
Uploaded files on flask (
request.files
) have.name
and.filename
, but the standard pythonBytesIO
sets the full path into.name
and werkzeug breaks functions depending on the.name
from file-like-objects to have the filename. Since.name
from werkzeug file-objects has the form-input-name.The workaround is a easy one, but still required me to debug and compare a python
BytesIO
with a werkzeugFileStorage
.Environment: