Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit 16b2125

Browse files
pirannamafintosh
authored andcommitted
strip linkname on hard links (#49)
It seems hard links are defined using relative paths from the root of the tar file... that absolutely makes sense since it's needed always an absolute reference inside the tar file itself but the initial slash is mostly useless because it will be always there :-P ``` > tar -tvf syslinux-6.03.tar.gz |grep bios/linux drwxrwxr-x hpa/hpa 0 2014-10-06 18:32 syslinux-6.03/bios/linux/ -rwxrwxr-x hpa/hpa 213600 2014-10-06 18:32 syslinux-6.03/bios/linux/syslinux-nomtools hrwxrwxr-x hpa/hpa 0 2014-10-06 18:32 syslinux-6.03/bios/linux/syslinux enlace a syslinux-6.03/bios/linux/syslinux-nomtools ``` Problem is that my previous commit introduced a regression here by not considering this use case. This change now fix it by allways strip `linkname` if it's from a hard link.
1 parent 861969b commit 16b2125

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ var strip = function (map, level) {
4848
header.name = header.name.split('/').slice(level).join('/')
4949

5050
var linkname = header.linkname
51-
if (linkname && path.isAbsolute(linkname)) {
51+
if (linkname && (header.type === 'link' || path.isAbsolute(linkname))) {
5252
header.linkname = linkname.split('/').slice(level).join('/')
5353
}
5454

0 commit comments

Comments
 (0)