From a4cd229b9410f604c92d00ab85d6f306afb6ee95 Mon Sep 17 00:00:00 2001 From: Shane C Date: Fri, 1 Nov 2024 14:14:39 -0400 Subject: [PATCH] fix default permissions --- extract.go | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/extract.go b/extract.go index 0b17069..19a9c7f 100644 --- a/extract.go +++ b/extract.go @@ -28,11 +28,11 @@ func extract(filesystem Filesystem, opts ExtractOptions, archive *Archive) error if filesystem.billyFS != nil { billyFS := filesystem.billyFS - if err := billyFS.MkdirAll(opts.Folder, os.ModePerm); err != nil { + if err := billyFS.MkdirAll(opts.Folder, 0740); err != nil { return err } } else if filesystem.file { - if err := os.MkdirAll(opts.Folder, os.ModePerm); err != nil { + if err := os.MkdirAll(opts.Folder, 0740); err != nil { return err } } @@ -61,11 +61,11 @@ func extractFile(filesystem Filesystem, opts ExtractFileOptions, file *File) err if filesystem.billyFS != nil { billyFS := filesystem.billyFS - if err := billyFS.MkdirAll(opts.Folder, os.ModePerm); err != nil { + if err := billyFS.MkdirAll(opts.Folder, 0740); err != nil { return err } } else if filesystem.file { - if err := os.MkdirAll(opts.Folder, os.ModePerm); err != nil { + if err := os.MkdirAll(opts.Folder, 0740); err != nil { return err } } @@ -113,11 +113,11 @@ func zipExtract(filesystem Filesystem, opts extractOptions, archive *Archive) er if isFound { if filesystem.billyFS != nil { billyFS := filesystem.billyFS - if err := billyFS.MkdirAll(filepath.Join(opts.Folder, zipF.Name), os.ModePerm); err != nil { + if err := billyFS.MkdirAll(filepath.Join(opts.Folder, zipF.Name), 0740); err != nil { return err } } else { - if err := os.MkdirAll(filepath.Join(opts.Folder, zipF.Name), os.ModePerm); err != nil { + if err := os.MkdirAll(filepath.Join(opts.Folder, zipF.Name), 0740); err != nil { return err } } @@ -127,11 +127,11 @@ func zipExtract(filesystem Filesystem, opts extractOptions, archive *Archive) er } else { if filesystem.billyFS != nil { billyFS := filesystem.billyFS - if err := billyFS.MkdirAll(filepath.Join(opts.Folder, zipF.Name), os.ModePerm); err != nil { + if err := billyFS.MkdirAll(filepath.Join(opts.Folder, zipF.Name), 0740); err != nil { return err } } else { - if err := os.MkdirAll(filepath.Join(opts.Folder, zipF.Name), os.ModePerm); err != nil { + if err := os.MkdirAll(filepath.Join(opts.Folder, zipF.Name), 0740); err != nil { return err } } @@ -160,7 +160,7 @@ func zipExtract(filesystem Filesystem, opts extractOptions, archive *Archive) er billyFS := filesystem.billyFS if _, err := billyFS.Stat(filepath.Join(opts.Folder, filepath.Dir(zipF.Name))); err != nil { if errors.Is(err, fs.ErrNotExist) { - if err := billyFS.MkdirAll(filepath.Join(opts.Folder, filepath.Dir(zipF.Name)), os.ModePerm); err != nil { + if err := billyFS.MkdirAll(filepath.Join(opts.Folder, filepath.Dir(zipF.Name)), 0740); err != nil { return err } } else { @@ -170,7 +170,7 @@ func zipExtract(filesystem Filesystem, opts extractOptions, archive *Archive) er } else { if _, err := os.Stat(filepath.Join(opts.Folder, filepath.Dir(zipF.Name))); err != nil { if errors.Is(err, fs.ErrNotExist) { - if err := os.MkdirAll(filepath.Join(opts.Folder, filepath.Dir(zipF.Name)), os.ModePerm); err != nil { + if err := os.MkdirAll(filepath.Join(opts.Folder, filepath.Dir(zipF.Name)), 0740); err != nil { return err } } else { @@ -257,11 +257,11 @@ func tarExtract(filesystem Filesystem, opts extractOptions, archive *Archive) er if isFound { if filesystem.billyFS != nil { billyFS := filesystem.billyFS - if err := billyFS.MkdirAll(filepath.Join(opts.Folder, header.Name), os.ModePerm); err != nil { + if err := billyFS.MkdirAll(filepath.Join(opts.Folder, header.Name), 0740); err != nil { return err } } else { - if err := os.MkdirAll(filepath.Join(opts.Folder, header.Name), os.ModePerm); err != nil { + if err := os.MkdirAll(filepath.Join(opts.Folder, header.Name), 0740); err != nil { return err } } @@ -270,11 +270,11 @@ func tarExtract(filesystem Filesystem, opts extractOptions, archive *Archive) er } else { if filesystem.billyFS != nil { billyFS := filesystem.billyFS - if err := billyFS.MkdirAll(filepath.Join(opts.Folder, header.Name), os.ModePerm); err != nil { + if err := billyFS.MkdirAll(filepath.Join(opts.Folder, header.Name), 0740); err != nil { return err } } else { - if err := os.MkdirAll(filepath.Join(opts.Folder, header.Name), os.ModePerm); err != nil { + if err := os.MkdirAll(filepath.Join(opts.Folder, header.Name), 0740); err != nil { return err } } @@ -304,7 +304,7 @@ func tarExtract(filesystem Filesystem, opts extractOptions, archive *Archive) er billyFS := filesystem.billyFS if _, err := billyFS.Stat(filepath.Join(opts.Folder, filepath.Dir(header.Name))); err != nil { if errors.Is(err, fs.ErrNotExist) { - if err := billyFS.MkdirAll(filepath.Join(opts.Folder, filepath.Dir(header.Name)), os.ModePerm); err != nil { + if err := billyFS.MkdirAll(filepath.Join(opts.Folder, filepath.Dir(header.Name)), 0740); err != nil { return err } } else { @@ -314,7 +314,7 @@ func tarExtract(filesystem Filesystem, opts extractOptions, archive *Archive) er } else { if _, err := os.Stat(filepath.Join(opts.Folder, filepath.Dir(header.Name))); err != nil { if errors.Is(err, fs.ErrNotExist) { - if err := os.MkdirAll(filepath.Join(opts.Folder, filepath.Dir(header.Name)), os.ModePerm); err != nil { + if err := os.MkdirAll(filepath.Join(opts.Folder, filepath.Dir(header.Name)), 0740); err != nil { return err } } else {