Skip to content

Commit

Permalink
fix: ensure external plugin can scaffold files in new dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
Eileen-Yu authored and Sajiyah-Salat committed Aug 22, 2023
1 parent 8c4df8c commit 268cf3e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/plugins/external/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,15 @@ func handlePluginResponse(fs machinery.Filesystem, req external.PluginRequest, p
}

for filename, data := range res.Universe {
f, err := fs.FS.Create(filepath.Join(currentDir, filename))
path := filepath.Join(currentDir, filename)
dir := filepath.Dir(path)

// create the directory if it does not exist
if err := os.MkdirAll(dir, 0o750); err != nil {
return fmt.Errorf("error creating the directory: %v", err)
}

f, err := fs.FS.Create(path)
if err != nil {
return err
}
Expand Down

0 comments on commit 268cf3e

Please sign in to comment.