diff --git a/framework/src/Volo.Abp.VirtualFileSystem/Volo/Abp/VirtualFileSystem/DictionaryBasedFileProvider.cs b/framework/src/Volo.Abp.VirtualFileSystem/Volo/Abp/VirtualFileSystem/DictionaryBasedFileProvider.cs index cb0786393b..63c2b0bc03 100644 --- a/framework/src/Volo.Abp.VirtualFileSystem/Volo/Abp/VirtualFileSystem/DictionaryBasedFileProvider.cs +++ b/framework/src/Volo.Abp.VirtualFileSystem/Volo/Abp/VirtualFileSystem/DictionaryBasedFileProvider.cs @@ -16,7 +16,7 @@ public abstract class DictionaryBasedFileProvider : IFileProvider return new NotFoundFileInfo(subpath!); } - var file = Files.GetOrDefault(NormalizePath(subpath)); + var file = Files.GetOrDefault(NormalizePath(subpath)) ?? Files.GetOrDefault(subpath); if (file == null) { diff --git a/framework/src/Volo.Abp.VirtualFileSystem/Volo/Abp/VirtualFileSystem/Embedded/AbpEmbeddedFileProvider.cs b/framework/src/Volo.Abp.VirtualFileSystem/Volo/Abp/VirtualFileSystem/Embedded/AbpEmbeddedFileProvider.cs index bacfce0495..05c5e867e7 100644 --- a/framework/src/Volo.Abp.VirtualFileSystem/Volo/Abp/VirtualFileSystem/Embedded/AbpEmbeddedFileProvider.cs +++ b/framework/src/Volo.Abp.VirtualFileSystem/Volo/Abp/VirtualFileSystem/Embedded/AbpEmbeddedFileProvider.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; +using System.Text.RegularExpressions; using JetBrains.Annotations; using Microsoft.Extensions.FileProviders; @@ -129,10 +130,35 @@ public class AbpEmbeddedFileProvider : DictionaryBasedFileProvider return resourceName; } - var folder = pathParts.Take(pathParts.Length - 2).JoinAsString("/"); - var fileName = pathParts[pathParts.Length - 2] + "." + pathParts[pathParts.Length - 1]; + if (pathParts.Length >= 4 && (pathParts[pathParts.Length - 2] == "min" || pathParts[pathParts.Length - 2] == "rtl")) + { + // Fix NET 10 RC 1 Microsoft.Extensions.FileProviders.Embedded issue temporarily + //https://github.com/dotnet/aspnetcore/issues/63719 + pathParts = pathParts[pathParts.Length - 3] == "bundle" + ? pathParts.Take(pathParts.Length - 4).Concat([pathParts.Skip(pathParts.Length - 4).JoinAsString(".")]).ToArray() + : pathParts.Take(pathParts.Length - 3).Concat([pathParts.Skip(pathParts.Length - 3).JoinAsString(".")]).ToArray(); + + if (pathParts.Length <= 2) + { + return resourceName; + } + + var folder = pathParts.Take(pathParts.Length - 1).JoinAsString("/").Replace("_", "-"); + var fileName = pathParts[pathParts.Length - 1].Replace("_", "-"); + return folder + "/" + fileName; + } + else + { + if (pathParts.Length <= 2) + { + return resourceName; + } + + var folder = pathParts.Take(pathParts.Length - 2).JoinAsString("/"); + var fileName = pathParts[pathParts.Length - 2] + "." + pathParts[pathParts.Length - 1]; - return folder + "/" + fileName; + return folder + "/" + fileName; + } } private static string CalculateFileName(string filePath)