Skip to content

Commit

Permalink
fixed the issue when validate a space path
Browse files Browse the repository at this point in the history
  • Loading branch information
2403905 committed Jul 5, 2024
1 parent fdd92bd commit f9c7bb4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/fix-space-put.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Validate a space path

We've fixed the issue when validating a space path

https://github.com/cs3org/reva/pull/4750
12 changes: 7 additions & 5 deletions internal/http/services/owncloud/ocdav/put.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,11 +411,13 @@ func (s *svc) handleSpacesPut(w http.ResponseWriter, r *http.Request, spaceID st
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
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
}
}

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

0 comments on commit f9c7bb4

Please sign in to comment.