Skip to content

Commit

Permalink
Mkdir all parent dirs for fs storager (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
reshke authored Aug 15, 2024
1 parent f2db008 commit b89afcb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/storage/filestorage.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ func (s *FileStorageInteractor) ListPath(prefix string) ([]*ObjectInfo, error) {
}

func (s *FileStorageInteractor) PutFileToDest(name string, r io.Reader) error {
file, err := os.Create(path.Join(s.cnf.StoragePrefix, name))
fPath := path.Join(s.cnf.StoragePrefix, name)
fDir := path.Dir(fPath)
os.MkdirAll(fDir, 0700)
file, err := os.Create(fPath)
if err != nil {
return err
}
Expand Down

0 comments on commit b89afcb

Please sign in to comment.