fix default permissions

This commit is contained in:
Shane C. 2024-11-01 14:14:39 -04:00
parent 92e6d1bae6
commit a4cd229b94
Signed by: Shane C.
GPG key ID: E46B5FEA35B22FF9

View file

@ -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 {