Skip to content

Commit

Permalink
Merge pull request #72 from fridvin-netapp/fix_handle_returned_from_c…
Browse files Browse the repository at this point in the history
…reate

Fix bug in CREATE when directory is not root
  • Loading branch information
willscott authored Sep 7, 2023
2 parents 2b8e63b + e46b34d commit 41b3696
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nfs_oncreate.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ func onCreate(ctx context.Context, w *response, userHandle Handler) error {
return &NFSStatusError{NFSStatusNameTooLong, nil}
}

newFilePath := fs.Join(append(path, string(obj.Filename))...)
newFile := append(path, string(obj.Filename))
newFilePath := fs.Join(newFile...)
if s, err := fs.Stat(newFilePath); err == nil {
if s.IsDir() {
return &NFSStatusError{NFSStatusExist, nil}
Expand All @@ -85,7 +86,7 @@ func onCreate(ctx context.Context, w *response, userHandle Handler) error {
return &NFSStatusError{NFSStatusAccess, err}
}

fp := userHandle.ToHandle(fs, append(path, file.Name()))
fp := userHandle.ToHandle(fs, newFile)
changer := userHandle.Change(fs)
if err := attrs.Apply(changer, fs, newFilePath); err != nil {
Log.Errorf("Error applying attributes: %v\n", err)
Expand Down

0 comments on commit 41b3696

Please sign in to comment.