Skip to content

Commit

Permalink
Do not apply linkpath,global from global pax header
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Apr 14, 2024
1 parent b0fbdea commit af04392
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/header.ts
Expand Up @@ -96,8 +96,9 @@ export class Header implements HeaderData {

// if we have extended or global extended headers, apply them now
// See https://github.com/npm/node-tar/pull/187
if (ex) this.#slurp(ex)
// Apply global before local, so it overrides
if (gex) this.#slurp(gex, true)
if (ex) this.#slurp(ex)

// old tar versions marked dirs as a file with a trailing /
const t = decString(buf, off + 156, 1)
Expand Down Expand Up @@ -168,7 +169,9 @@ export class Header implements HeaderData {
return !(
v === null ||
v === undefined ||
(k === 'path' && gex)
(k === 'path' && gex) ||
(k === 'linkpath' && gex) ||
(k === 'global')
)
}),
),
Expand Down
2 changes: 2 additions & 0 deletions test/header.js
Expand Up @@ -614,6 +614,8 @@ t.test('null block, global extended header', t => {
{
path: '/global.path',
foo: 'global foo',
global: true,
linkpath: 'asdf'
},
)
t.match(h, {
Expand Down

0 comments on commit af04392

Please sign in to comment.