Paket pack doesn't escape square brackets
Nobody has claimed this yet.
- Dominant language
- F#
- Stars
- 2.1k
- Forks
- 528
- Avg merge
- 1d 12m
- Merged PRs (30d)
- 54
Description
Description
Nuget packages (*.nupkg) conform to the "Open Packaging Concentions", OPC. Thus files within a package are URL-adressed. This also means that reserved chars need to be percent-encoded. For most chars paket pack does the encoding correctly (e.g. a space becomes %20). Square brackets, however, get through unescaped (i.e. [] does not become %5B%5D).
This becomes an issue when processing a nuget package with .NET's OPC API (System.IO.Packaging). If a part contains a square bracket an ArgumentException is thrown, stating that the URI is not valid. And indeed, according to RFC 3986 (cf. very end of Appendix A) square brackets are reserved within a path segment and thus need to be percent-encoded.
Repro steps
- Create a paket.template that harvests a directory
- ensure there is a file within the harvested dir that contains square brackets (e.g.
file[0].txt) paket packthat template
Expected behavior
The file within the resulting nuget should look like this: file%5B0%5D.txt.
Actual behavior
The file actually looks like this: file[0].txt.
Known workarounds
None I'm aware of.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the paket pack command and reproduce the issue using a harvested file named file[0].txt. Trace how harvested filenames are written into the resulting NuGet package; done means square brackets are percent-encoded as %5B and %5D, and the reproduction no longer produces an invalid OPC part URI.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fsharp
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100