Skip to content

Commit

Permalink
Ensure the folders have the proper permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
matteosuppo committed Feb 15, 2017
1 parent 5e532d2 commit 3b4ea67
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func Zip(body io.Reader, location string, rename Renamer) error {

switch {
case info.IsDir():
if err := os.MkdirAll(path, info.Mode()); err != nil {
if err := os.MkdirAll(path, info.Mode()|os.ModeDir|100); err != nil {
return errors.Annotatef(err, "Create directory %s", path)
}
// We only check for symlinks because hard links aren't possible
Expand Down Expand Up @@ -219,7 +219,8 @@ func Zip(body io.Reader, location string, rename Renamer) error {
}

func copy(path string, mode os.FileMode, src io.Reader) error {
err := os.MkdirAll(filepath.Dir(path), mode|os.ModeDir)
// We add the execution permission to be able to create files inside it
err := os.MkdirAll(filepath.Dir(path), mode|os.ModeDir|100)
if err != nil {
return err
}
Expand Down
Binary file modified testdata/archive.zip
Binary file not shown.

0 comments on commit 3b4ea67

Please sign in to comment.