Skip to content

Commit

Permalink
Create the directory before create the file
Browse files Browse the repository at this point in the history
  • Loading branch information
sluongng committed Dec 5, 2024
1 parent d69edb1 commit 30405e1
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1337,6 +1337,9 @@ func downloadLayer(ctx context.Context, layer ctr.Layer, destDir string) error {
return status.UnavailableErrorf("create directory: %s", err)
}
case tar.TypeReg:
if err := os.MkdirAll(dir, os.FileMode(header.Mode)); err != nil {
return status.UnavailableErrorf("create directory: %s", err)
}
f, err := os.OpenFile(target, os.O_CREATE|os.O_WRONLY, os.FileMode(header.Mode))
if err != nil {
return status.UnavailableErrorf("create file: %s", err)
Expand Down

0 comments on commit 30405e1

Please sign in to comment.