aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Robibero <cody@robibe.ro>2022-03-30 20:10:12 -0600
committercrobibero <cody@robibe.ro>2022-04-07 12:54:58 -0400
commite086eebb71f7d950750e7a21ec4c059f6f352458 (patch)
tree82b70d9650113977f095d43b71874c213e7fe218
parent1960b5bdce50476b500d25cc957799e501e4f61b (diff)
Merge pull request #7525 from 1337joe/fix-duplicate-library-media-paths
(cherry picked from commit bebe1808ce529cff867b5b0c207542aadc9aedff) Signed-off-by: crobibero <cody@robibe.ro>
-rw-r--r--Emby.Server.Implementations/Library/LibraryManager.cs4
1 files changed, 3 insertions, 1 deletions
diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs
index a9428ae9b..d6754ad4a 100644
--- a/Emby.Server.Implementations/Library/LibraryManager.cs
+++ b/Emby.Server.Implementations/Library/LibraryManager.cs
@@ -2840,10 +2840,12 @@ namespace Emby.Server.Implementations.Library
var existingNameCount = 1; // first numbered name will be 2
var 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;