diff --git a/changelog/unreleased/fix-space-put.md b/changelog/unreleased/fix-space-put.md new file mode 100644 index 00000000000..fa33dde528e --- /dev/null +++ b/changelog/unreleased/fix-space-put.md @@ -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 diff --git a/internal/http/services/owncloud/ocdav/put.go b/internal/http/services/owncloud/ocdav/put.go index 9619461e4e8..a6beee48b35 100644 --- a/internal/http/services/owncloud/ocdav/put.go +++ b/internal/http/services/owncloud/ocdav/put.go @@ -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)