Sfoglia il codice sorgente

Fixed Invalid Character handling in DocumentCache.GetFolder()

frogsoftware 1 anno fa
parent
commit
207bcd4634
1 ha cambiato i file con 2 aggiunte e 1 eliminazioni
  1. 2 1
      InABox.Core/DocumentCache.cs

+ 2 - 1
InABox.Core/DocumentCache.cs

@@ -363,7 +363,8 @@ namespace InABox.Core
 
 
         private string GetFolder()
         private string GetFolder()
         {
         {
-            return Path.Combine(CoreUtils.GetPath(), DocumentCaches.ServerName ?? "", "_documentcache", Tag);
+            var sanitised = String.Join("_", DocumentCaches.ServerName.Split(System.IO.Path.GetInvalidFileNameChars(), StringSplitOptions.RemoveEmptyEntries) ).TrimEnd('.');
+            return Path.Combine(CoreUtils.GetPath(), sanitised ?? "", "_documentcache", Tag);
         }
         }
 
 
         private string GetFileName(Guid documentID)
         private string GetFileName(Guid documentID)