[Blazor][Fixes #14999] Razor Class Library Static Assets with spaces do not resolve (#15024)

This commit is contained in:
Javier Calvarro Nelson 2019-10-15 22:17:05 +02:00 committed by GitHub
parent 0dad6fec71
commit 579f30f591
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 2 deletions

View File

@ -46,7 +46,7 @@ namespace Microsoft.AspNetCore.Hosting.StaticWebAssets
}
else
{
return InnerProvider.GetDirectoryContents(physicalPath);
return InnerProvider.GetDirectoryContents(physicalPath.Value);
}
}
@ -59,7 +59,7 @@ namespace Microsoft.AspNetCore.Hosting.StaticWebAssets
}
else
{
return InnerProvider.GetFileInfo(physicalPath);
return InnerProvider.GetFileInfo(physicalPath.Value);
}
}

View File

@ -9,6 +9,7 @@
<Compile Include="$(SharedSourceRoot)EventSource.Testing\TestEventListener.cs" />
<Compile Include="$(SharedSourceRoot)EventSource.Testing\TestCounterListener.cs" />
<Content Include="testroot\**\*" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" />
<None Remove="testroot\wwwroot\Static Web Assets.txt" />
<Content Include="Microsoft.AspNetCore.Hosting.StaticWebAssets.xml" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

View File

@ -37,6 +37,17 @@ namespace Microsoft.AspNetCore.Hosting.StaticWebAssets
Assert.Equal("/_content", provider.BasePath);
}
[Fact]
public void StaticWebAssetsFileProvider_FindsFileWithSpaces()
{
// Arrange & Act
var provider = new StaticWebAssetsFileProvider("/_content",
Path.Combine(AppContext.BaseDirectory, "testroot", "wwwroot"));
// Assert
Assert.True(provider.GetFileInfo("/_content/Static Web Assets.txt").Exists);
}
[Fact]
public void GetFileInfo_DoesNotMatch_IncompletePrefixSegments()
{

View File

@ -0,0 +1 @@
This file is here to validate that the static web assets file provider respect spaces.