forked from mia/0x0
fix 500 error when file extension could not be guessed
when a file without an extension was uploaded and the mimetypes.guess_extension returned None because there is no official file extension for that mimetype a NoneType was subscripted which yielded a 500 http error
This commit is contained in:
parent
e1e99957b6
commit
3950f6e8eb
1 changed files with 3 additions and 1 deletions
4
fhost.py
4
fhost.py
|
@ -247,8 +247,10 @@ class File(db.Model):
|
|||
if not ext:
|
||||
if gmime in app.config["FHOST_EXT_OVERRIDE"]:
|
||||
ext = app.config["FHOST_EXT_OVERRIDE"][gmime]
|
||||
elif guess:
|
||||
ext = guess
|
||||
else:
|
||||
ext = guess_extension(gmime)
|
||||
ext = ""
|
||||
|
||||
return ext[:app.config["FHOST_MAX_EXT_LENGTH"]] or ".bin"
|
||||
|
||||
|
|
Loading…
Reference in a new issue