From d9ade4ba6e47d0f9144104cc701e8897895dd19d Mon Sep 17 00:00:00 2001 From: tastytea Date: Thu, 2 Feb 2023 21:13:26 +0100 Subject: [PATCH] add check for WebP support Signed-off-by: tastytea --- synapse/rest/media/v1/__init__.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/synapse/rest/media/v1/__init__.py b/synapse/rest/media/v1/__init__.py index d5b74cddf1..995ed89fad 100644 --- a/synapse/rest/media/v1/__init__.py +++ b/synapse/rest/media/v1/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2014-2016 OpenMarket Ltd +# Copyright 2014-2016,2023 OpenMarket Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from PIL.features import check_codec +from PIL.features import check_codec, check_module # check for JPEG support. if not check_codec("jpg"): @@ -30,3 +30,12 @@ if not check_codec("zlib"): " 'sudo apt-get install libjpeg-dev' then 'pip uninstall pillow &&" " pip install pillow --user'" ) + + +# check for WebP support. +if not check_module("webp"): + raise Exception( + "FATAL: webp module not supported. Install pillow correctly! " + " 'sudo apt-get install libwebp-dev' then 'pip uninstall pillow &&" + " pip install pillow --user'" + )