diff --git a/src/NzbDrone.Common.Test/OsPathFixture.cs b/src/NzbDrone.Common.Test/OsPathFixture.cs index a7c20f866..992ea11fd 100644 --- a/src/NzbDrone.Common.Test/OsPathFixture.cs +++ b/src/NzbDrone.Common.Test/OsPathFixture.cs @@ -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() { diff --git a/src/NzbDrone.Common/Disk/OsPath.cs b/src/NzbDrone.Common/Disk/OsPath.cs index bed4c67c6..9028ec1f7 100644 --- a/src/NzbDrone.Common/Disk/OsPath.cs +++ b/src/NzbDrone.Common/Disk/OsPath.cs @@ -71,7 +71,12 @@ 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;