diff --git a/src/WebOptimizer.Core/Processors/RelativePathAdjuster.cs b/src/WebOptimizer.Core/Processors/RelativePathAdjuster.cs index bdd1602..66a9ad1 100644 --- a/src/WebOptimizer.Core/Processors/RelativePathAdjuster.cs +++ b/src/WebOptimizer.Core/Processors/RelativePathAdjuster.cs @@ -25,7 +25,7 @@ public override Task ExecuteAsync(IAssetContext config) foreach (string key in config.Content.Keys) { IFileInfo input = fileProvider.GetFileInfo(key); - string outputPath = Path.Combine(env.WebRootPath, config.Asset.Route); + string outputPath = Path.Combine(env.WebRootPath, config.Asset.Route.TrimStart('/')); content[key] = Adjust(config.Content[key].AsString(), input.PhysicalPath, outputPath); } diff --git a/test/WebOptimizer.Core.Test/Processors/RelativePathAdjusterTest.cs b/test/WebOptimizer.Core.Test/Processors/RelativePathAdjusterTest.cs index f16e309..ffde580 100644 --- a/test/WebOptimizer.Core.Test/Processors/RelativePathAdjusterTest.cs +++ b/test/WebOptimizer.Core.Test/Processors/RelativePathAdjusterTest.cs @@ -34,7 +34,7 @@ public async Task AdjustRelativePaths_Success(string url, string newUrl) .Returns(@"//source"); context.SetupGet(s => s.Asset.Route) - .Returns(@"dist/all.css"); + .Returns(@"/dist/all.css"); context.Setup(s => s.HttpContext.RequestServices.GetService(typeof(IAssetPipeline))) .Returns(pipeline.Object);