Accept WebP payloads in ImageProxyAction
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 2 Sep 2022 07:16:31 +0000 (09:16 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 2 Sep 2022 07:28:40 +0000 (09:28 +0200)
wcfsetup/install/files/images/proxy/.htaccess
wcfsetup/install/files/lib/action/ImageProxyAction.class.php

index 51fb39d1df7be8fba4cfa337721babef8409e0f3..02fed3c5bc9a4f9908363fcb083e1bbfdb9e545c 100644 (file)
@@ -1,4 +1,4 @@
 Require all denied
-<FilesMatch ".+\.(gif|jpe?g|png)$">
+<FilesMatch ".+\.(gif|jpe?g|png|webp)$">
        Require all granted
 </FilesMatch>
index 9d9e8b9959344d0be6dfaf509f0c1026273b995d..4b6b13bc674176608c86b087c0f21d8af5802ebd 100644 (file)
@@ -103,7 +103,7 @@ class ImageProxyAction extends AbstractAction
 
             // check whether we already downloaded the image
             $fileLocation = null;
-            foreach (['png', 'jpg', 'gif'] as $extension) {
+            foreach (['png', 'jpg', 'gif', 'webp'] as $extension) {
                 if (\is_file($dir . '/' . $fileName . '.' . $extension)) {
                     $fileLocation = $dir . '/' . $fileName . '.' . $extension;
                     break;
@@ -185,6 +185,9 @@ class ImageProxyAction extends AbstractAction
                         case \IMAGETYPE_JPEG:
                             $extension = 'jpg';
                             break;
+                        case \IMAGETYPE_WEBP:
+                            $extension = 'webp';
+                            break;
                         default:
                             throw new \DomainException();
                     }