Skip to content

Commit a5e45bd

Browse files
committed
fix(serverHandler/archiveTar): add "execute" mode to directory
1 parent 8e55074 commit a5e45bd

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/serverHandler/archiveTar.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,23 @@ func writeTar(tw *tar.Writer, f *os.File, fInfo os.FileInfo, archivePath string)
1212
if archivePath[0] == '/' {
1313
archivePath = archivePath[1:]
1414
}
15-
if fInfo.IsDir() {
16-
archivePath += "/"
17-
}
1815

16+
var typeFlag byte
17+
var mode int64
1918
var size int64
20-
if !fInfo.IsDir() {
19+
if fInfo.IsDir() {
20+
archivePath += "/"
21+
typeFlag = tar.TypeDir
22+
mode = 0755
23+
} else {
24+
mode = 0644
2125
size = fInfo.Size()
2226
}
2327

2428
header := &tar.Header{
2529
Name: archivePath,
26-
Mode: 0664,
30+
Typeflag: typeFlag,
31+
Mode: mode,
2732
Size: size,
2833
ModTime: fInfo.ModTime(),
2934
AccessTime: fInfo.ModTime(),

0 commit comments

Comments
 (0)