Skip to content

Commit 7abbc6d

Browse files
Ensure directory is made within zip artifacts (#4985)
* Ensure directory is made within zip artifacts * Make test:release extraction stricter
1 parent f4cb313 commit 7abbc6d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

magefile.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,9 @@ func packageWindows(arch string) error {
791791
if err != nil {
792792
return fmt.Errorf("unable to turn dir stat into header: %w", err)
793793
}
794+
if !strings.HasSuffix(dirHeader.Name, "/") {
795+
dirHeader.Name += "/"
796+
}
794797
_, err = zw.CreateHeader(dirHeader)
795798
if err != nil {
796799
return fmt.Errorf("unable to create zip dir: %w", err)
@@ -1421,10 +1424,6 @@ func unzip(sourceFile, destinationDir string) error {
14211424
return os.MkdirAll(path, f.Mode())
14221425
}
14231426

1424-
if err = os.MkdirAll(filepath.Dir(path), 0o755); err != nil {
1425-
return err
1426-
}
1427-
14281427
out, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, f.Mode())
14291428
if err != nil {
14301429
return err

0 commit comments

Comments
 (0)