maliming
4 months ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
2 changed files with
19 additions and
0 deletions
-
framework/src/Volo.Abp.AspNetCore.Components.Web.Theming/Bundling/ComponentBundleUrlBuilder.cs
-
framework/test/Volo.Abp.AspNetCore.Components.Web.Theming.Tests/Volo/Abp/AspNetCore/Components/Web/Theming/Bundling/ComponentBundleUrlBuilder_Tests.cs
|
|
|
@ -34,6 +34,11 @@ public class ComponentBundleUrlBuilder : IComponentBundleUrlBuilder, ITransientD |
|
|
|
return Task.FromResult(fileName); |
|
|
|
} |
|
|
|
|
|
|
|
if (fileName.StartsWith(normalized, StringComparison.Ordinal)) |
|
|
|
{ |
|
|
|
return Task.FromResult(fileName); |
|
|
|
} |
|
|
|
|
|
|
|
return Task.FromResult(normalized + fileName.RemovePreFix("/")); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -102,4 +102,18 @@ public class ComponentBundleUrlBuilder_Tests |
|
|
|
(await _builder.BuildAsync("/__bundles/Global.css", appBasePath: " ", navigationBaseUri: "https://localhost/foo/")) |
|
|
|
.ShouldBe("/foo/__bundles/Global.css"); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public async Task Should_Be_Idempotent_For_Already_Prefixed_FileName() |
|
|
|
{ |
|
|
|
(await _builder.BuildAsync("/foo/__bundles/Global.css", appBasePath: "/foo", navigationBaseUri: null)) |
|
|
|
.ShouldBe("/foo/__bundles/Global.css"); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public async Task Should_Be_Idempotent_When_PathBase_Resolved_From_NavigationBaseUri() |
|
|
|
{ |
|
|
|
(await _builder.BuildAsync("/foo/__bundles/Global.css", appBasePath: null, navigationBaseUri: "https://localhost/foo/")) |
|
|
|
.ShouldBe("/foo/__bundles/Global.css"); |
|
|
|
} |
|
|
|
} |
|
|
|
|