From 79d9ac90dc7748f173945d554fa2ac3051761ced Mon Sep 17 00:00:00 2001 From: Christian McHugh Date: Fri, 18 Sep 2026 11:23:26 +0000 Subject: [PATCH] fix(icon): skip pixel dimension check for SVG uploads SVG is vector-based and scales to any size, so the 16/24/32px square requirement for raster icons should not apply. PHP's getimagesize() can return dimensions from an SVG's width/height attributes (e.g. 2500x2500), which previously caused valid SVG icons to be rejected with 'Provided image is not a square'. --- lib/Controller/IconController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Controller/IconController.php b/lib/Controller/IconController.php index 91a7a452..4a0ff0b9 100644 --- a/lib/Controller/IconController.php +++ b/lib/Controller/IconController.php @@ -63,8 +63,8 @@ public function uploadIcon(): DataResponse { ], Http::STATUS_UNPROCESSABLE_ENTITY); } - if ($imageSize !== false && (!in_array($imageSize[0], [16, 24, 32], true) || $imageSize[0] !== $imageSize[1])) { - // Not a square + if ($icon['type'] !== 'image/svg+xml' && $imageSize !== false && (!in_array($imageSize[0], [16, 24, 32], true) || $imageSize[0] !== $imageSize[1])) { + // Not a square - SVG is vector-based and scales to any size, so skip the pixel dimension check return new DataResponse([ 'error' => $this->l10n->t('Provided image is not a square of 16, 24 or 32 pixels width'), ], Http::STATUS_UNPROCESSABLE_ENTITY);