Removed supported image file types from configuration and set up as a property on IImageUrlGenerator, so different providers can indicate support for different sets of images.

This commit is contained in:
Andy Butland
2020-09-22 15:06:03 +02:00
parent c2f343b17d
commit f42e8856db
17 changed files with 77 additions and 56 deletions

View File

@@ -11,6 +11,7 @@ using Umbraco.Core;
using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Hosting;
using Umbraco.Core.Media;
using Umbraco.Core.WebAssets;
using Umbraco.Extensions;
using Umbraco.Web.BackOffice.Profiling;
@@ -41,6 +42,7 @@ namespace Umbraco.Web.BackOffice.Controllers
private readonly SecuritySettings _securitySettings;
private readonly IRuntimeMinifier _runtimeMinifier;
private readonly IAuthenticationSchemeProvider _authenticationSchemeProvider;
private readonly IImageUrlGenerator _imageUrlGenerator;
public BackOfficeServerVariables(
LinkGenerator linkGenerator,
@@ -55,7 +57,8 @@ namespace Umbraco.Web.BackOffice.Controllers
IOptions<RuntimeSettings> runtimeSettings,
IOptions<SecuritySettings> securitySettings,
IRuntimeMinifier runtimeMinifier,
IAuthenticationSchemeProvider authenticationSchemeProvider)
IAuthenticationSchemeProvider authenticationSchemeProvider,
IImageUrlGenerator imageUrlGenerator)
{
_linkGenerator = linkGenerator;
_runtimeState = runtimeState;
@@ -70,6 +73,7 @@ namespace Umbraco.Web.BackOffice.Controllers
_securitySettings = securitySettings.Value;
_runtimeMinifier = runtimeMinifier;
_authenticationSchemeProvider = authenticationSchemeProvider;
_imageUrlGenerator = imageUrlGenerator;
}
/// <summary>
@@ -363,7 +367,7 @@ namespace Umbraco.Web.BackOffice.Controllers
{"appPluginsPath", _hostingEnvironment.ToAbsolute(Constants.SystemDirectories.AppPlugins).TrimEnd('/')},
{
"imageFileTypes",
string.Join(",", _contentSettings.Imaging.ImageFileTypes)
string.Join(",", _imageUrlGenerator.SupportedImageFileTypes)
},
{
"disallowedUploadFiles",