diff --git a/src/Paket.Core/LockFile.fs b/src/Paket.Core/LockFile.fs index 9858e83051..d1daebdcec 100644 --- a/src/Paket.Core/LockFile.fs +++ b/src/Paket.Core/LockFile.fs @@ -421,8 +421,22 @@ module LockFileParser = | GitHubLink | GistLink -> match currentGroup.RemoteUrl |> Option.map(fun s -> s.Split '/') with | Some [| owner; project |] -> + let pieces = + if details.Contains '"' then + let pathInfo = + match details.IndexOf ('"', 1) with + | idx when idx >= 0 -> Some (details.Substring (1, idx - 1), idx) + | _ -> None + match pathInfo with + | Some (path, pathEndIdx) -> + let commitAndAuthKey = details.Substring(pathEndIdx + 1).Split(' ') + Array.append [| path |] commitAndAuthKey + | None -> Array.empty + else + details.Split ' ' + let path, commit, authKey = - match details.Split ' ' with + match pieces with | [| filePath; commit; authKey |] -> filePath, commit |> removeBrackets, (Some authKey) | [| filePath; commit |] -> filePath, commit |> removeBrackets, None | _ -> failwith "invalid file source details." diff --git a/tests/Paket.Tests/Lockfile/ParserSpecs.fs b/tests/Paket.Tests/Lockfile/ParserSpecs.fs index be500f46a1..baee8631cc 100644 --- a/tests/Paket.Tests/Lockfile/ParserSpecs.fs +++ b/tests/Paket.Tests/Lockfile/ParserSpecs.fs @@ -880,3 +880,25 @@ let ``should parse local git lock file with build and no specs``() = lockFile.Head.SourceFiles.Head.Commit |> shouldEqual "2942d23fcb13a2574b635194203aed7610b21903" lockFile.Head.SourceFiles.Head.Project |> shouldEqual "nupkgtest" lockFile.Head.SourceFiles.Head.Command |> shouldEqual (Some "build.cmd Test") + +let lockFileWithFilesContainingSpaces = """ +GITHUB + remote: owner/repo + specs: + "file 1.fs" (7623fc13439f0e60bd05c1ed3b5f6dcb937fe468)""" + +[] +let ``should parse lock file with spaces in file names``() = + let lockFile = LockFileParser.Parse (toLines lockFileWithFilesContainingSpaces) + let sourceFiles = List.rev lockFile.Head.SourceFiles + sourceFiles|> shouldEqual + [ { Owner = "owner" + Project = "repo" + Name = "file 1.fs" + Origin = ModuleResolver.Origin.GitHubLink + Dependencies = Set.empty + Commit = "7623fc13439f0e60bd05c1ed3b5f6dcb937fe468" + Command = None + OperatingSystemRestriction = None + PackagePath = None + AuthKey = None } ]