Repository navigation
[repo-assist] Add regression test confirming square brackets are escaped in nupkg entries (#3906) - #4420
Conversation
…nupkg entries Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…test-dee11b6b93f7a4a9
|
/repo-assist fix the failing CI |
|
✗ Repo Assist encountered failed, see workflow run.
|
The regression test added in this PR for #3906 failed in CI on the net461/Mono legs (Linux and Windows), even though it passed on net10.0. Root cause: ensureValidName in NupkgWriter.fs percent-encodes the target path with Uri.EscapeDataString, then round-trips it through Uri.GetComponents(SafeUnescaped) / Uri.GetComponents(UriEscaped) to restore characters that are valid in file/folder names but were escaped unnecessarily (e.g. '@'). That round-trip treats square brackets ('[' / ']') as "safe" on some runtimes (unescaping them back to literal brackets) but not on others, producing inconsistent, runtime-dependent zip entry names. Fix: percent-encode '[' and ']' the same way the existing '@'/'+'/'%' "problem characters" are protected - hide them from the Uri round-trip with a placeholder, then substitute their fixed percent-encoded form back in afterwards. This makes escaping deterministic across runtimes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🤖 This is an automated response from Repo Assist. Fixed the failing CI. The regression test I added for #3906 was itself exposing a real cross-runtime inconsistency in
Fix: Test Status
Added a
Add this agentic workflow to your repoTo install this agentic workflow, run |
…test-dee11b6b93f7a4a9
🤖 This is an automated contribution from Repo Assist, an automated AI assistant.
Relates to #3906 ("paket pack doesn't escape square brackets").
Investigation
I traced the packing pipeline in
NupkgWriter.fs(ensureValidName, used byaddEntryFromFile) and tested it directly against a file namedfile[0].txt. In the current codebase, this path already produces a correctly escaped zip entry name (file%5B0%5D.txt), not the unescapedfile[0].txtreported in the issue. I could not find any git history since the issue was filed indicating a targeted fix, so this may have been resolved indirectly (e.g. via theUri-based round-trip inensureValidName), or the original repro used a different, older Paket version.Since I can't rule out a repro path I haven't hit, I'm not claiming the issue is fully resolved — but I've added a regression test to lock in and document the current (correct) behavior, so any regression here would be caught immediately.
Change
tests/Paket.Tests/Packaging/NupkgWriterSpecs.fs: packs a folder containingfile[0].txtviaNupkgWriter.Writeand asserts the resulting nupkg's zip entry islib/net461/file%5B0%5D.txt(escaped), not the raw bracketed name.Paket.Tests.fsproj.No production code changes — this is a pure test addition intended to give maintainers confidence and a safety net while they decide on the final disposition of #3906.
Test Status
dotnet test tests/Paket.Tests/Paket.Tests.fsproj --filter "FullyQualifiedName~NupkgWriter": Passed onnet10.0(1/1).net461target aborted in this sandbox only becausemonois not installed here (infrastructure limitation, unrelated to the change) — worth re-running in CI where mono is available.I'll also leave a comment on #3906 summarizing this finding so maintainers can confirm whether the issue is fully closed or if there's another repro path to track down.
Add this agentic workflow to your repo
To install this agentic workflow, run