mirror of
https://github.com/Readarr/Readarr
synced 2026-05-08 12:42:51 +02:00
Fixed: Replace duplicate slashes from file names when importing
Fixes #3470
This commit is contained in:
parent
0d3798b8b1
commit
921bfdb20d
2 changed files with 16 additions and 1 deletions
|
|
@ -185,6 +185,15 @@ public void should_fix_slashes_unix()
|
||||||
osPath.FullPath.Should().Be(@"/just/a/test/to/verify the/slashes/");
|
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]
|
[Test]
|
||||||
public void should_combine_mixed_slashes()
|
public void should_combine_mixed_slashes()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,13 @@ private static string FixSlashes(string path, OsPathKind kind)
|
||||||
case OsPathKind.Windows:
|
case OsPathKind.Windows:
|
||||||
return path.Replace('/', '\\');
|
return path.Replace('/', '\\');
|
||||||
case OsPathKind.Unix:
|
case OsPathKind.Unix:
|
||||||
return path.Replace('\\', '/');
|
path = path.Replace('\\', '/');
|
||||||
|
while (path.Contains("//"))
|
||||||
|
{
|
||||||
|
path = path.Replace("//", "/");
|
||||||
|
}
|
||||||
|
|
||||||
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue