Merge pull request #7525 from 1337joe/fix-duplicate-library-media-paths

(cherry picked from commit bebe1808ce529cff867b5b0c207542aadc9aedff)
Signed-off-by: crobibero <cody@robibe.ro>
This commit is contained in:
Cody Robibero 2022-03-30 20:10:12 -06:00 committed by crobibero
parent 1960b5bdce
commit e086eebb71

View File

@ -2840,10 +2840,12 @@ namespace Emby.Server.Implementations.Library
var existingNameCount = 1; // first numbered name will be 2 var existingNameCount = 1; // first numbered name will be 2
var virtualFolderPath = Path.Combine(rootFolderPath, name); var virtualFolderPath = Path.Combine(rootFolderPath, name);
var originalName = name;
while (Directory.Exists(virtualFolderPath)) while (Directory.Exists(virtualFolderPath))
{ {
existingNameCount++; existingNameCount++;
virtualFolderPath = Path.Combine(rootFolderPath, name + " " + existingNameCount); name = originalName + existingNameCount;
virtualFolderPath = Path.Combine(rootFolderPath, name);
} }
var mediaPathInfos = options.PathInfos; var mediaPathInfos = options.PathInfos;