mirror of
https://git.0x0.st/mia/0x0.git
synced 2026-01-09 20:11:46 +03:00
Prevent unreasonably long MIME types
This commit is contained in:
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"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user