Prevent unreasonably long MIME types
This commit is contained in:
parent
77801efd21
commit
57c4b6853f
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 New Issue
Block a user