diff --git a/src/Umbraco.Infrastructure/Composing/CompositionExtensions/FileSystems.cs b/src/Umbraco.Infrastructure/Composing/CompositionExtensions/FileSystems.cs index 0ae91cb4d8..9dc130fcba 100644 --- a/src/Umbraco.Infrastructure/Composing/CompositionExtensions/FileSystems.cs +++ b/src/Umbraco.Infrastructure/Composing/CompositionExtensions/FileSystems.cs @@ -92,7 +92,17 @@ namespace Umbraco.Core.Composing.CompositionExtensions // register the IFileSystem supporting the IMediaFileSystem // THIS IS THE ONLY THING THAT NEEDS TO CHANGE, IN ORDER TO REPLACE THE UNDERLYING FILESYSTEM // and, SupportingFileSystem.For() returns the underlying filesystem - composition.SetMediaFileSystem(factory => new PhysicalFileSystem(factory.GetInstance(),factory.GetInstance(), factory.GetInstance(), factory.GetInstance().UmbracoMediaPath)); + composition.SetMediaFileSystem(factory => + { + var ioHelper = factory.GetInstance(); + var hostingEnvironment = factory.GetInstance(); + var logger = factory.GetInstance(); + var globalSettings = factory.GetInstance(); + + var rootPath = hostingEnvironment.MapPathWebRoot(globalSettings.UmbracoMediaPath); + var rootUrl = hostingEnvironment.ToAbsolute(globalSettings.UmbracoMediaPath); + return new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, rootPath, rootUrl); + }); return composition; }