Fixed: Replace duplicate slashes from file names when importing

Fixes #3470
pull/3489/head
gl3nni3 5 years ago committed by Mark McDowall
parent c6ea7d7e63
commit 2d94857369

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

@ -71,7 +71,12 @@ namespace NzbDrone.Common.Disk
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…
Cancel
Save