mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 11:34:57 +02:00
Fix move condition
This commit is contained in:
parent
7b3edb8737
commit
ac569421a9
1 changed files with 6 additions and 0 deletions
|
@ -76,6 +76,11 @@ namespace MediaBrowser.Api.Library
|
|||
}
|
||||
|
||||
if (!string.Equals(currentPath, newPath, StringComparison.OrdinalIgnoreCase) && Directory.Exists(newPath))
|
||||
{
|
||||
throw new ArgumentException("There is already a media collection with the name " + newPath + ".");
|
||||
}
|
||||
//Only make a two-phase move when changing capitalization
|
||||
if (string.Equals(currentPath, newPath, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
//Create an unique name
|
||||
var temporaryName = Guid.NewGuid().ToString();
|
||||
|
@ -83,6 +88,7 @@ namespace MediaBrowser.Api.Library
|
|||
Directory.Move(currentPath,temporaryPath);
|
||||
currentPath = temporaryPath;
|
||||
}
|
||||
|
||||
Directory.Move(currentPath, newPath);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue