Serve Media and App_Plugins using WebRootFileProvider (and allow changing the physical media path) (#11783)
* Allow changing UmbracoMediaPath to an absolute path. Also ensure Imagesharp are handing requests outside of the wwwroot folder. * Let UmbracoMediaUrl fallback to UmbracoMediaPath when empty * Add FileSystemFileProvider to expose an IFileSystem as IFileProvider * Replace IUmbracoMediaFileProvider with IFileProviderFactory implementation * Fix issue resolving relative paths when media URL has changed * Remove FileSystemFileProvider and require explicitly implementing IFileProviderFactory * Update tests (UnauthorizedAccessException isn't thrown anymore for rooted files) * Update test to use UmbracoMediaUrl * Add UmbracoMediaPhysicalRootPath global setting * Remove MediaFileManagerImageProvider and use composited file providers * Move CreateFileProvider to IFileSystem extension method * Add rooted path tests Co-authored-by: Ronald Barendse <ronald@barend.se>
This commit is contained in:
@@ -44,7 +44,7 @@ namespace Umbraco.Cms.Infrastructure.Install
|
||||
hostingEnvironment.MapPathWebRoot(_globalSettings.UmbracoCssPath),
|
||||
hostingEnvironment.MapPathContentRoot(Constants.SystemDirectories.Config),
|
||||
hostingEnvironment.MapPathContentRoot(Constants.SystemDirectories.Data),
|
||||
hostingEnvironment.MapPathWebRoot(_globalSettings.UmbracoMediaPath),
|
||||
hostingEnvironment.MapPathWebRoot(_globalSettings.UmbracoMediaPhysicalRootPath),
|
||||
hostingEnvironment.MapPathContentRoot(Constants.SystemDirectories.Preview)
|
||||
};
|
||||
_packagesPermissionsDirs = new[]
|
||||
@@ -70,7 +70,7 @@ namespace Umbraco.Cms.Infrastructure.Install
|
||||
EnsureFiles(_permissionFiles, out errors);
|
||||
report[FilePermissionTest.FileWriting] = errors.ToList();
|
||||
|
||||
EnsureCanCreateSubDirectory(_hostingEnvironment.MapPathWebRoot(_globalSettings.UmbracoMediaPath), out errors);
|
||||
EnsureCanCreateSubDirectory(_hostingEnvironment.MapPathWebRoot(_globalSettings.UmbracoMediaPhysicalRootPath), out errors);
|
||||
report[FilePermissionTest.MediaFolderCreation] = errors.ToList();
|
||||
|
||||
return report.Sum(x => x.Value.Count()) == 0;
|
||||
|
||||
Reference in New Issue
Block a user