diff --git a/jar/jar.go b/jar/jar.go index a8f06a4f3..f164ee1ee 100644 --- a/jar/jar.go +++ b/jar/jar.go @@ -77,7 +77,7 @@ func MetaDirFileHeader() *zip.FileHeader { Name: MetaDir, Extra: []byte{MetaDirExtra[1], MetaDirExtra[0], 0, 0}, } - dirHeader.SetMode(0700 | os.ModeDir) + dirHeader.SetMode(0755 | os.ModeDir) dirHeader.SetModTime(DefaultTime) return dirHeader @@ -95,7 +95,7 @@ func ManifestFileContents(contents []byte) (*zip.FileHeader, []byte, error) { Method: zip.Store, UncompressedSize64: uint64(len(b)), } - fh.SetMode(0700) + fh.SetMode(0644) fh.SetModTime(DefaultTime) return fh, b, nil diff --git a/zip/zip.go b/zip/zip.go index 6e412c956..ae379f52e 100644 --- a/zip/zip.go +++ b/zip/zip.go @@ -656,9 +656,9 @@ func (z *ZipWriter) addFile(dest, src string, method uint16, emulateJar, srcJar UncompressedSize64: uint64(fileSize), } - mode := os.FileMode(0600) + mode := os.FileMode(0644) if executable { - mode = 0700 + mode = 0755 } header.SetMode(mode) @@ -955,7 +955,7 @@ func (z *ZipWriter) writeDirectory(dir string, src string, emulateJar bool) erro dirHeader = &zip.FileHeader{ Name: cleanDir + "/", } - dirHeader.SetMode(0700 | os.ModeDir) + dirHeader.SetMode(0755 | os.ModeDir) } dirHeader.SetModTime(z.time) diff --git a/zip/zip_test.go b/zip/zip_test.go index 441dea3bd..79cc0b4b7 100644 --- a/zip/zip_test.go +++ b/zip/zip_test.go @@ -62,7 +62,7 @@ func fh(name string, contents []byte, method uint16) zip.FileHeader { Method: method, CRC32: crc32.ChecksumIEEE(contents), UncompressedSize64: uint64(len(contents)), - ExternalAttrs: (syscall.S_IFREG | 0600) << 16, + ExternalAttrs: (syscall.S_IFREG | 0644) << 16, } } @@ -72,7 +72,7 @@ func fhManifest(contents []byte) zip.FileHeader { Method: zip.Store, CRC32: crc32.ChecksumIEEE(contents), UncompressedSize64: uint64(len(contents)), - ExternalAttrs: (syscall.S_IFREG | 0700) << 16, + ExternalAttrs: (syscall.S_IFREG | 0644) << 16, } } @@ -92,7 +92,7 @@ func fhDir(name string) zip.FileHeader { Method: zip.Store, CRC32: crc32.ChecksumIEEE(nil), UncompressedSize64: 0, - ExternalAttrs: (syscall.S_IFDIR|0700)<<16 | 0x10, + ExternalAttrs: (syscall.S_IFDIR|0755)<<16 | 0x10, } }