Jelajahi Sumber

fixed remove path validation

LukePulverenti 12 tahun lalu
induk
melakukan
05b9500175
1 mengubah file dengan 3 tambahan dan 4 penghapusan
  1. 3 4
      MediaBrowser.Api/Library/LibraryHelpers.cs

+ 3 - 4
MediaBrowser.Api/Library/LibraryHelpers.cs

@@ -98,16 +98,15 @@ namespace MediaBrowser.Api.Library
 
             if (!Directory.Exists(path))
             {
-                throw new DirectoryNotFoundException("The media folder does not exist");
+                throw new DirectoryNotFoundException(string.Format("The media collection {0} does not exist", virtualFolderName));
             }
 
             var shortcut = Directory.EnumerateFiles(path, "*.lnk", SearchOption.AllDirectories).FirstOrDefault(f => FileSystem.ResolveShortcut(f).Equals(mediaPath, StringComparison.OrdinalIgnoreCase));
 
-            if (string.IsNullOrEmpty(shortcut))
+            if (!string.IsNullOrEmpty(shortcut))
             {
-                throw new DirectoryNotFoundException("The media folder does not exist");
+                File.Delete(shortcut);
             }
-            File.Delete(shortcut);
         }
 
         /// <summary>