Skip to content

Commit 128737e

Browse files
authored
chore: Update extract logic for using newer 7zz/7zzs/7zr.exe binaries (#139)
* Conditionally adds `-snld` flag when detecting not `7za` binary to allow extracting relative links outside of host dir (to maintain backward compatibility with legacy 7za versus newer 7zz/7zzs/7zr.exe)
1 parent 28db936 commit 128737e

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

.changeset/strange-pianos-move.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"app-builder-bin": patch
3+
---
4+
5+
chore: Update extract logic for using newer 7zz/7zzs/7zr.exe binaries

pkg/download/artifactDownloader.go

+10-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"github.com/develar/app-builder/pkg/log"
1313
"github.com/develar/app-builder/pkg/util"
1414
"github.com/develar/errors"
15-
"github.com/develar/go-fs-util"
15+
fsutil "github.com/develar/go-fs-util"
1616
"github.com/mitchellh/go-homedir"
1717
"go.uber.org/zap"
1818
)
@@ -115,7 +115,15 @@ func DownloadArtifact(dirName string, url string, checksum string) (string, erro
115115
return "", err
116116
}
117117
} else {
118-
command := exec.Command(util.Get7zPath(), "x", "-bd", archiveName, "-o"+tempUnpackDir)
118+
path7zX := util.Get7zPath()
119+
var args []string
120+
args = append(args, "x")
121+
if !strings.HasSuffix(path7zX, "7za") {
122+
// -snld flag for https://sourceforge.net/p/sevenzip/bugs/2356/ to maintain backward compatibility between versions of 7za (old) and 7zz/7zzs/7zr.exe (new)
123+
args = append(args, "-snld")
124+
}
125+
args = append(args, "-bd", archiveName, "-o"+tempUnpackDir)
126+
command := exec.Command(path7zX, args...)
119127
command.Dir = cacheDir
120128
_, err := util.Execute(command)
121129
if err != nil {

0 commit comments

Comments
 (0)