Skip to content

Commit

Permalink
Ensure trailing slash on target dir
Browse files Browse the repository at this point in the history
  • Loading branch information
Vidar L. Sømme authored and forki committed Apr 8, 2015
1 parent 4b3cd6a commit a55113b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Paket.Core/NupkgWriter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@ let Write (core : CompleteCoreInfo) optional workingDir outputDir =
writerF stream
stream.Close()

let ensureValidTargetName (target:string) =
match target.Replace(" ", "%20") with
| t when t.EndsWith("/") -> t
| t -> t + "/"

// adds all files in a directory to the zipFile
let rec addDir source target =
for file in Directory.EnumerateFiles(source,"*.*",SearchOption.TopDirectoryOnly) do
Expand All @@ -215,7 +220,7 @@ let Write (core : CompleteCoreInfo) optional workingDir outputDir =

// add files
for fileName,targetFileName in optional.Files do
let targetFileName = targetFileName.Replace(" ", "%20")
let targetFileName = ensureValidTargetName targetFileName
let source = Path.Combine(workingDir, fileName)
if Directory.Exists source then
addDir source targetFileName
Expand Down

1 comment on commit a55113b

@neoeinstein
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change seems to be the root cause of #756.

Please sign in to comment.