From 4574fe8789ae4221e28153be151f84abd03d324e 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..6fc85492a5 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 detect application/zip anymore. case ( "application/zip-compressed" | "application/x-zip-compressed", - "application/zip", + "application/zip" | "application/octet-stream", "zip", ): return