Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Intidos 1 post 71 karma points
    Nov 25, 2021 @ 09:30
    Intidos
    0

    Breaking change to how acceptedfiletypes is determined in v9?

    I am having a problem with a new V9 install whereby content editors cannot upload svg files with the Media Picker upload button on 9.0.1 - keep getting the message 'Cannot upload this file. It does not have an approved type'.

    Doing a bit of digging into the angular views and core, in V8 the list of allowed types comes from js script which injects the value of umbracosettings.imageFileTypes, which in v8 comes from the umbracosetting.config file and can be changed in the

    In v9 changing the equivalent setting in the appsetting.json has no effect, and the value of acceptedfiletypes in the media picker is always a fixed list of .png,.jpg,.jpeg,.jfif,.gif,.bm,.bmp,.dip,.tga,vda,.icb,.vst

    Digging into the core it seems this list now comes from the service which implements IImageUrlGenerator - which for the default install is ImageSharp, specifically this constructor:

    https://github.com/umbraco/Umbraco-CMS/blob/004d3410e9d2eb9e7cc0962e1fb97bcbb2e8bd34/src/Umbraco.Infrastructure/Media/ImageSharpImageUrlGenerator.cs#L25

        public ImageSharpImageUrlGenerator(Configuration configuration)
            : this(configuration.ImageFormats.SelectMany(f => f.FileExtensions).ToArray())
        { }
    

    the configuration DI'ed into that constructor is not the appsettings from the appsettings.json but SixLabors.ImageSharp.Configuration. So the allowed filetypes is only whatever ImageSharp supports in terms of file extensions (does not include svgs), and is not overridden by the imageFileTypes settings in the .net core config.

    I cannot find any documentation that explains why this has changed for V9, is anyone else having this problem and should I log it as an issue?

Please Sign in or register to post replies

Write your reply to:

Draft