diff options
| author | jonas-w <git@03j.de> | 2023-01-15 19:28:21 +0100 |
|---|---|---|
| committer | Jonas Wunderlich <git@jonas-wunderlich.de> | 2023-01-15 20:36:39 +0100 |
| commit | 3950f6e8ebf264ff5fb7c4302f11667e41c0ce21 (patch) | |
| tree | a1100d024ed707bb191dce669bc639cd8d45b777 | |
| parent | e1e99957b6188cce657485f15ff3708fef9e5999 (diff) | |
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
| -rwxr-xr-x | fhost.py | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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" |
