Skip to content

Commit

Permalink
skip the file name validation if nodeid is used
Browse files Browse the repository at this point in the history
  • Loading branch information
2403905 committed Jul 17, 2024
1 parent 11ee452 commit fc1811a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/fix-filename-validation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Fixed the file name validation if nodeid is used

We have fixed the file name validation if nodeid is used

https://github.com/cs3org/reva/pull/4767
https://github.com/owncloud/ocis/issues/9568
17 changes: 10 additions & 7 deletions internal/http/services/owncloud/ocdav/put.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,13 +412,16 @@ func (s *svc) handleSpacesPut(w http.ResponseWriter, r *http.Request, spaceID st
return
}

if r.URL.Path != "/" {
if err := ValidateName(filepath.Base(ref.Path), s.nameValidators); err != nil {
w.WriteHeader(http.StatusBadRequest)
b, err := errors.Marshal(http.StatusBadRequest, err.Error(), "", "")
errors.HandleWebdavError(&sublog, w, b, err)
return
}
if ref.GetResourceId().GetOpaqueId() != "" && ref.GetResourceId().GetSpaceId() != ref.GetResourceId().OpaqueId && r.URL.Path == "/" {
s.handlePut(ctx, w, r, &ref, sublog)
return
}

if err := ValidateName(filename(ref.Path), s.nameValidators); err != nil {
w.WriteHeader(http.StatusBadRequest)
b, err := errors.Marshal(http.StatusBadRequest, err.Error(), "", "")
errors.HandleWebdavError(&sublog, w, b, err)
return
}

s.handlePut(ctx, w, r, &ref, sublog)
Expand Down

0 comments on commit fc1811a

Please sign in to comment.