The Free Software Media System - Server Backend & API
Merge pull request #7525 from 1337joe/fix-duplicate-library-media-paths
Cody Robiberoe086eebb71f7
diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.csindex a9428ae9bc..d6754ad4a8 100644--- a/Emby.Server.Implementations/Library/LibraryManager.cs+++ b/Emby.Server.Implementations/Library/LibraryManager.cs@@ -2840,10 +2840,12 @@ namespace Emby.Server.Implementations.Libraryvar existingNameCount = 1; // first numbered name will be 2var virtualFolderPath = Path.Combine(rootFolderPath, name);+ var originalName = name;while (Directory.Exists(virtualFolderPath)){existingNameCount++;- virtualFolderPath = Path.Combine(rootFolderPath, name + " " + existingNameCount);+ name = originalName + existingNameCount;+ virtualFolderPath = Path.Combine(rootFolderPath, name);}var mediaPathInfos = options.PathInfos;