From af043922c09d12d28e21ecb463c7c9ff375cbf47 Mon Sep 17 00:00:00 2001 From: isaacs Date: Sun, 14 Apr 2024 14:43:59 -0700 Subject: [PATCH] Do not apply linkpath,global from global pax header --- src/header.ts | 7 +++++-- test/header.js | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/header.ts b/src/header.ts index e648876e..0ff3f84b 100644 --- a/src/header.ts +++ b/src/header.ts @@ -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) @@ -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') ) }), ), diff --git a/test/header.js b/test/header.js index 8d3eb06e..92554a65 100644 --- a/test/header.js +++ b/test/header.js @@ -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, {