From e3fc7c0ad1227c4baf568eb323de2a26bddebc43 Mon Sep 17 00:00:00 2001 From: Leigh Pointer Date: Thu, 18 Feb 2021 08:38:53 +0100 Subject: [PATCH] #1120 Fix forUpload SVG throw error --- Oqtane.Server/Controllers/FileController.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Oqtane.Server/Controllers/FileController.cs b/Oqtane.Server/Controllers/FileController.cs index ce36dae2..9e8b3d35 100644 --- a/Oqtane.Server/Controllers/FileController.cs +++ b/Oqtane.Server/Controllers/FileController.cs @@ -538,10 +538,15 @@ namespace Oqtane.Controllers if (Constants.ImageFiles.Split(',').Contains(file.Extension.ToLower())) { FileStream stream = new FileStream(filepath, FileMode.Open, FileAccess.Read); - using (var image = Image.FromStream(stream)) - { - file.ImageHeight = image.Height; - file.ImageWidth = image.Width; + + //svg has no image and height, the attributes for svg are held in the XML viewport + if(file.Extension != "svg") + { + using (var image = Image.FromStream(stream)) + { + file.ImageHeight = image.Height; + file.ImageWidth = image.Width; + } } stream.Close();