1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2025-02-25 15:22:42 +00:00

Fixed: Replace duplicate slashes from file names when importing

Fixes #3470
This commit is contained in:
gl3nni3 2020-01-05 02:52:45 +01:00 committed by Qstick
parent 48750780fe
commit a229062e6f
2 changed files with 16 additions and 1 deletions

View file

@ -185,6 +185,15 @@ public void should_fix_slashes_unix()
osPath.FullPath.Should().Be(@"/just/a/test/to/verify the/slashes/");
}
[Test]
public void should_fix_double_slashes_unix()
{
var osPath = new OsPath(@"/just/a//test////to/verify the/slashes/");
osPath.Kind.Should().Be(OsPathKind.Unix);
osPath.FullPath.Should().Be(@"/just/a/test/to/verify the/slashes/");
}
[Test]
public void should_combine_mixed_slashes()
{

View file

@ -85,7 +85,13 @@ private static string FixSlashes(string path, OsPathKind kind)
case OsPathKind.Windows:
return path.Replace('/', '\\');
case OsPathKind.Unix:
return path.Replace('\\', '/');
path = path.Replace('\\', '/');
while (path.Contains("//"))
{
path = path.Replace("//", "/");
}
return path;
}
return path;