Prechádzať zdrojové kódy

新增获取文件时忽略文件名后缀

linhong 3 rokov pred
rodič
commit
4bbeabe4d4

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1 - 1
Properties/PublishProfiles/FolderProfile.pubxml.user


+ 11 - 0
Providers/L1SvrFileProvider.cs

@@ -4,6 +4,7 @@ using Microsoft.Extensions.FileProviders;
 using Microsoft.Extensions.Primitives;
 using System;
 using System.Collections.Generic;
+using System.IO;
 using System.Linq;
 using System.Threading.Tasks;
 
@@ -30,6 +31,13 @@ namespace LJProxy.Providers
         public IFileInfo GetFileInfo(string subpath)
         {
             string physicSubpath = subpath.Replace("/","\\");
+            int suffixIndex = physicSubpath.IndexOf(DocumentSuffix);
+            if (suffixIndex > 0)
+            {
+                string fileExtension = Path.GetExtension(physicSubpath);
+                physicSubpath = physicSubpath.Substring(0, suffixIndex);
+                physicSubpath = physicSubpath + fileExtension;
+            }
             string directory = @$"{_contentRoot}\wwwroot";
             var fullFilepath = @$"{directory}{physicSubpath}";
             _token = _accessor.HttpContext.Request.Headers["Authorization"];
@@ -37,6 +45,9 @@ namespace LJProxy.Providers
             return result;
         }
 
+        private readonly static string DocumentSuffix = "$27BAljSuffix!";
+
+
         public IChangeToken Watch(string filter)
         {
             throw new NotImplementedException();