mirror of
https://git.0x0.st/mia/0x0.git
synced 2024-12-23 00:28:57 -05:00
Prevent unreasonably long MIME types
This commit is contained in:
parent
77801efd21
commit
57c4b6853f
1 changed files with 3 additions and 0 deletions
3
fhost.py
3
fhost.py
|
@ -227,6 +227,9 @@ class File(db.Model):
|
||||||
if mime in app.config["FHOST_MIME_BLACKLIST"] or guess in app.config["FHOST_MIME_BLACKLIST"]:
|
if mime in app.config["FHOST_MIME_BLACKLIST"] or guess in app.config["FHOST_MIME_BLACKLIST"]:
|
||||||
abort(415)
|
abort(415)
|
||||||
|
|
||||||
|
if len(mime) > 128:
|
||||||
|
abort(400)
|
||||||
|
|
||||||
if mime.startswith("text/") and not "charset" in mime:
|
if mime.startswith("text/") and not "charset" in mime:
|
||||||
mime += "; charset=utf-8"
|
mime += "; charset=utf-8"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue