diff options
| author | Mia Herkt <mia@0x0.st> | 2022-12-13 23:41:12 +0100 |
|---|---|---|
| committer | Mia Herkt <mia@0x0.st> | 2022-12-13 23:41:12 +0100 |
| commit | 57c4b6853f1b33ab55a630c5b0810ba667ba017a (patch) | |
| tree | 8b8f6a873bc92e1d1f4e31ce2294c29b6e3657e7 /fhost.py | |
| parent | 77801efd216e0725e913942d2014f4d5e6600bd5 (diff) | |
Prevent unreasonably long MIME types
Diffstat (limited to 'fhost.py')
| -rwxr-xr-x | fhost.py | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -227,6 +227,9 @@ class File(db.Model): if mime in app.config["FHOST_MIME_BLACKLIST"] or guess in app.config["FHOST_MIME_BLACKLIST"]: abort(415) + if len(mime) > 128: + abort(400) + if mime.startswith("text/") and not "charset" in mime: mime += "; charset=utf-8" |
