fix default permissions
This commit is contained in:
parent
92e6d1bae6
commit
a4cd229b94
1 changed files with 16 additions and 16 deletions
32
extract.go
32
extract.go
|
@ -28,11 +28,11 @@ func extract(filesystem Filesystem, opts ExtractOptions, archive *Archive) error
|
||||||
|
|
||||||
if filesystem.billyFS != nil {
|
if filesystem.billyFS != nil {
|
||||||
billyFS := filesystem.billyFS
|
billyFS := filesystem.billyFS
|
||||||
if err := billyFS.MkdirAll(opts.Folder, os.ModePerm); err != nil {
|
if err := billyFS.MkdirAll(opts.Folder, 0740); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
} else if filesystem.file {
|
} 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
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,11 +61,11 @@ func extractFile(filesystem Filesystem, opts ExtractFileOptions, file *File) err
|
||||||
|
|
||||||
if filesystem.billyFS != nil {
|
if filesystem.billyFS != nil {
|
||||||
billyFS := filesystem.billyFS
|
billyFS := filesystem.billyFS
|
||||||
if err := billyFS.MkdirAll(opts.Folder, os.ModePerm); err != nil {
|
if err := billyFS.MkdirAll(opts.Folder, 0740); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
} else if filesystem.file {
|
} 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
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,11 +113,11 @@ func zipExtract(filesystem Filesystem, opts extractOptions, archive *Archive) er
|
||||||
if isFound {
|
if isFound {
|
||||||
if filesystem.billyFS != nil {
|
if filesystem.billyFS != nil {
|
||||||
billyFS := filesystem.billyFS
|
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
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} 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
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,11 +127,11 @@ func zipExtract(filesystem Filesystem, opts extractOptions, archive *Archive) er
|
||||||
} else {
|
} else {
|
||||||
if filesystem.billyFS != nil {
|
if filesystem.billyFS != nil {
|
||||||
billyFS := filesystem.billyFS
|
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
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} 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
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ func zipExtract(filesystem Filesystem, opts extractOptions, archive *Archive) er
|
||||||
billyFS := filesystem.billyFS
|
billyFS := filesystem.billyFS
|
||||||
if _, err := billyFS.Stat(filepath.Join(opts.Folder, filepath.Dir(zipF.Name))); err != nil {
|
if _, err := billyFS.Stat(filepath.Join(opts.Folder, filepath.Dir(zipF.Name))); err != nil {
|
||||||
if errors.Is(err, fs.ErrNotExist) {
|
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
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -170,7 +170,7 @@ func zipExtract(filesystem Filesystem, opts extractOptions, archive *Archive) er
|
||||||
} else {
|
} else {
|
||||||
if _, err := os.Stat(filepath.Join(opts.Folder, filepath.Dir(zipF.Name))); err != nil {
|
if _, err := os.Stat(filepath.Join(opts.Folder, filepath.Dir(zipF.Name))); err != nil {
|
||||||
if errors.Is(err, fs.ErrNotExist) {
|
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
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -257,11 +257,11 @@ func tarExtract(filesystem Filesystem, opts extractOptions, archive *Archive) er
|
||||||
if isFound {
|
if isFound {
|
||||||
if filesystem.billyFS != nil {
|
if filesystem.billyFS != nil {
|
||||||
billyFS := filesystem.billyFS
|
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
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} 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
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -270,11 +270,11 @@ func tarExtract(filesystem Filesystem, opts extractOptions, archive *Archive) er
|
||||||
} else {
|
} else {
|
||||||
if filesystem.billyFS != nil {
|
if filesystem.billyFS != nil {
|
||||||
billyFS := filesystem.billyFS
|
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
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} 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
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -304,7 +304,7 @@ func tarExtract(filesystem Filesystem, opts extractOptions, archive *Archive) er
|
||||||
billyFS := filesystem.billyFS
|
billyFS := filesystem.billyFS
|
||||||
if _, err := billyFS.Stat(filepath.Join(opts.Folder, filepath.Dir(header.Name))); err != nil {
|
if _, err := billyFS.Stat(filepath.Join(opts.Folder, filepath.Dir(header.Name))); err != nil {
|
||||||
if errors.Is(err, fs.ErrNotExist) {
|
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
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -314,7 +314,7 @@ func tarExtract(filesystem Filesystem, opts extractOptions, archive *Archive) er
|
||||||
} else {
|
} else {
|
||||||
if _, err := os.Stat(filepath.Join(opts.Folder, filepath.Dir(header.Name))); err != nil {
|
if _, err := os.Stat(filepath.Join(opts.Folder, filepath.Dir(header.Name))); err != nil {
|
||||||
if errors.Is(err, fs.ErrNotExist) {
|
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
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue