Browse Source

Workaround for .NET 10 RC1 embedded file provider issue

Adds a temporary fix for a known issue with Microsoft.Extensions.FileProviders.Embedded in .NET 10 RC1, ensuring correct resource name extraction for web content folders. See https://github.com/dotnet/aspnetcore/issues/63719 for details.
pull/23609/head
maliming 1 year ago
parent
commit
96699c8edc
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 15
      framework/src/Volo.Abp.VirtualFileSystem/Volo/Abp/VirtualFileSystem/Embedded/AbpEmbeddedFileProvider.cs

15
framework/src/Volo.Abp.VirtualFileSystem/Volo/Abp/VirtualFileSystem/Embedded/AbpEmbeddedFileProvider.cs

@ -107,6 +107,21 @@ public class AbpEmbeddedFileProvider : DictionaryBasedFileProvider
{ {
resourceName = resourceName.Substring(BaseNamespace!.Length + 1); resourceName = resourceName.Substring(BaseNamespace!.Length + 1);
} }
else
{
// Fix NET 10 RC 1 Microsoft.Extensions.FileProviders.Embedded issue temporarily
//https://github.com/dotnet/aspnetcore/issues/63719
string[] webContentFolders = ["Pages", "Views", "Themes", "Components"];
foreach (var contentFolder in webContentFolders.Where(contentFolder => resourceName.Contains($".{contentFolder}.")))
{
var index = resourceName.IndexOf(contentFolder, StringComparison.CurrentCultureIgnoreCase);
if (index > 0)
{
resourceName = resourceName.Substring(index);
}
break;
}
}
var pathParts = resourceName.Split('.'); var pathParts = resourceName.Split('.');
if (pathParts.Length <= 2) if (pathParts.Length <= 2)

Loading…
Cancel
Save