Skip to content

Commit

Permalink
fix nested file writes not auto-creating directory in local asset pro…
Browse files Browse the repository at this point in the history
…vider
  • Loading branch information
Southclaws committed Dec 27, 2024
1 parent d82c7bd commit b029961
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/infrastructure/object/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ func (s *localStorer) Read(ctx context.Context, path string) (io.Reader, int64,
func (s *localStorer) Write(ctx context.Context, path string, r io.Reader, size int64) error {
fullpath := filepath.Join(s.path, path)

dir := filepath.Dir(fullpath)
if err := os.MkdirAll(dir, 0o755); err != nil {
return fault.Wrap(err, fctx.With(ctx))
}

f, err := os.OpenFile(fullpath,
os.O_CREATE|os.O_WRONLY,
0o755,
Expand Down

0 comments on commit b029961

Please sign in to comment.