From e35b76a12b3f5a580fafb0cf408e868d45908bc5 Mon Sep 17 00:00:00 2001
From: Daniel Kesselberg <mail@danielkesselberg.de>
Date: Sun, 1 Mar 2020 00:34:28 +0100
Subject: [PATCH] Don't try to resize a svg uploaded as background image.

image* are gd functions without support for svg hence we are not able to resize svg.

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
---
 apps/theming/lib/Controller/ThemingController.php | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/apps/theming/lib/Controller/ThemingController.php b/apps/theming/lib/Controller/ThemingController.php
index b7e878f2e7e..d043c64f853 100644
--- a/apps/theming/lib/Controller/ThemingController.php
+++ b/apps/theming/lib/Controller/ThemingController.php
@@ -280,8 +280,7 @@ class ThemingController extends Controller {
 			);
 		}
 
-		$resizeKeys = ['background'];
-		if (in_array($key, $resizeKeys, true)) {
+		if ($key === 'background' && strpos($detectedMimeType, 'image/svg') === false) {
 			// Optimize the image since some people may upload images that will be
 			// either to big or are not progressive rendering.
 			$newImage = @imagecreatefromstring(file_get_contents($image['tmp_name'], 'r'));
-- 
GitLab