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,10 +173,9 @@ def get_form_value(
|
|||
):
|
||||
fail("400 Bad Request", f"Invalid value for field: {name}")
|
||||
data = value_object.file.read()
|
||||
with magic.Magic() as magic_instance:
|
||||
mime_type = magic_instance.from_buffer(data)
|
||||
if mime_type not in VALID_MIME_TYPES:
|
||||
fail("400 Bad Request", f"Invalid MIME type {mime_type} for upload: {name}")
|
||||
mime_type = magic.from_buffer(data, mime=True)
|
||||
if mime_type not in VALID_MIME_TYPES:
|
||||
fail("400 Bad Request", f"Invalid MIME type {mime_type} for upload: {name}")
|
||||
return (value_object.filename or "upload"), data
|
||||
else:
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue