From aa43480c08d34070592f204566672ff5eec2a2ee Mon Sep 17 00:00:00 2001 From: Sergei Maertens Date: Mon, 30 Dec 2024 14:10:03 +0100 Subject: [PATCH] :alien: [#4795] Handle libmagic 5.46 behaviour Validated with Sonny who's also using Arch - since libmagic 5.46 the detected content type for these 'exotic' zip formats no longer reports application/zip, but instead it returns application/octet-stream, or otherwise said: it doesn't know those magic bytes (anymore). Given the earlier patches, all we can do is allow these files to go through. Our Docker images are based on Debian bookworm, which ships libmagic 5.44. Debian unstable currently still has 5.44. --- src/openforms/formio/api/validators.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/openforms/formio/api/validators.py b/src/openforms/formio/api/validators.py index af1d042443..f794d567d2 100644 --- a/src/openforms/formio/api/validators.py +++ b/src/openforms/formio/api/validators.py @@ -132,9 +132,10 @@ def __call__(self, value: UploadedFile) -> None: # which is deprecated but still we need to support it. Instead, the common # case for zip files is application/zip or application/zip-compressed # mimetype. + # libmagic 5.46+ doesn't detected application/zip anymore. case ( "application/zip-compressed" | "application/x-zip-compressed", - "application/zip", + "application/zip" | "application/octet-stream", "zip", ): return