Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions drivers/local/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@ func (d *Local) Link(ctx context.Context, file model.Obj, args model.LinkArgs) (
}

func (d *Local) MakeDir(ctx context.Context, parentDir model.Obj, dirName string) error {
// Validate dirName to ensure it does not contain invalid characters
if filepath.Base(dirName) != dirName {
return fmt.Errorf("invalid directory name: %q", dirName)
}
fullPath := filepath.Join(parentDir.GetPath(), dirName)
err := os.MkdirAll(fullPath, os.FileMode(d.mkdirPerm))
if err != nil {
Expand Down