Fixed: Replace duplicate slashes from file names when importing

Fixes #3470
pull/1689/head
gl3nni3 4 years ago committed by Qstick
parent 48750780fe
commit a229062e6f

@ -185,6 +185,15 @@ namespace NzbDrone.Common.Test
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()
{

@ -85,7 +85,13 @@ namespace NzbDrone.Common.Disk
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;

Loading…
Cancel
Save