Skip to content

fix: flatten path separators in pack output filename - #9446

Merged
owlstronaut merged 1 commit into
npm:latestfrom
rootvector2:flatten-pack-filename-separators
Jun 2, 2026
Merged

fix: flatten path separators in pack output filename#9446
owlstronaut merged 1 commit into
npm:latestfrom
rootvector2:flatten-pack-filename-separators

Conversation

@rootvector2

Copy link
Copy Markdown
Contributor

npm pack writes the tarball to a name built from manifest.name with a non-global .replace(/\//, '-'), which only strips the single scope slash. When packing a remote tarball, git, or directory spec the name comes from a package.json that the registry never validated, so a name like x/../../../escaped keeps its ../ segments and path.resolve(packDestination, filename) lands the tarball outside the destination. Make the separator replacement global so the filename is always one path component.

@rootvector2
rootvector2 requested review from a team as code ownersJune 1, 2026 07:37
@owlstronautowlstronaut changed the title flatten path separators in pack output filenamefix: flatten path separators in pack output filenameJun 2, 2026
@owlstronaut
owlstronaut merged commit 76f8059 into npm:latestJun 2, 2026
18 of 19 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🎉 Backport to release/v11 created: #9468

owlstronaut pushed a commit that referenced this pull request Jun 2, 2026
Backport of #9446 to `release/v11`.
Co-authored-by: Dexter.k <164054284+rootvector2@users.noreply.github.com>
@github-actionsgithub-actionsBot mentioned this pull request Jun 2, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@rootvector2@owlstronaut