Not a bug Asset upload does not accept SVG

Kirby

Well-known member
Affected version
2.2.9
This is somewhat unfortunate as it absolutely makes sense to use SVGs for things like the logo (xenforo.com for example does use a SVG).
 
It works for me... Weirdly it even works for .svgz, even though only .svg is called out as a valid extension (maybe the browser considers .svgz the same as .svg)?

You can see the extensions that XenForo allows for asset uploads in XF\Service\Asset\Upload
PHP:
public static function getValidAssetExtensions()
{
   return ['gif', 'jpg', 'jpeg', 'jpe', 'png', 'svg'];
}

Inspecting the HTML in the asset upload input shows them there:
HTML:
<input type="file" class="js-uploadAsset" accept=".gif,.jpg,.jpeg,.jpe,.png,.svg">

Still confused on why the browser lets me select .svgz when it's not an accepted extension, but w/e... The setImageFromFile() method will throw an exception if it gets an unsupported extension, so probably .svgz should be added.

Either way, for me, .svg works as expected... .svgz is allowed to be selected by the browser, but XenForo throws an exception for that.
 
Seems like this was already adressed in 2.2.10 (but not documented in the release announcement ...), 2.2.9 doesn't have this code.
 
Top Bottom