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"]:
|
||||
abort(415)
|
||||
|
||||
if len(mime) > 128:
|
||||
abort(400)
|
||||
|
||||
if mime.startswith("text/") and not "charset" in mime:
|
||||
mime += "; charset=utf-8"
|
||||
|
||||
|
|
Loading…
Reference in a new issue