mirror of
https://codeberg.org/angestoepselt/homepage.git
synced 2026-03-21 22:32:17 +00:00
parent
3d850eb121
commit
da40de2759
1 changed files with 3 additions and 4 deletions
|
|
@ -173,8 +173,7 @@ def get_form_value(
|
||||||
):
|
):
|
||||||
fail("400 Bad Request", f"Invalid value for field: {name}")
|
fail("400 Bad Request", f"Invalid value for field: {name}")
|
||||||
data = value_object.file.read()
|
data = value_object.file.read()
|
||||||
with magic.Magic() as magic_instance:
|
mime_type = magic.from_buffer(data, mime=True)
|
||||||
mime_type = magic_instance.from_buffer(data)
|
|
||||||
if mime_type not in VALID_MIME_TYPES:
|
if mime_type not in VALID_MIME_TYPES:
|
||||||
fail("400 Bad Request", f"Invalid MIME type {mime_type} for upload: {name}")
|
fail("400 Bad Request", f"Invalid MIME type {mime_type} for upload: {name}")
|
||||||
return (value_object.filename or "upload"), data
|
return (value_object.filename or "upload"), data
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue