Reapply "adapt test for #514 (#2255)" (#2305)

This reverts commit f21207ed96.
This commit is contained in:
Ralf Haferkamp
2026-02-09 14:23:24 +01:00
committed by GitHub
parent ab9c4d8f23
commit c33850f213
44 changed files with 1774 additions and 739 deletions
@@ -97,6 +97,10 @@ func (s *svc) handleSpacesMkCol(w http.ResponseWriter, r *http.Request, spaceID
sublog := appctx.GetLogger(ctx).With().Str("path", r.URL.Path).Str("spaceid", spaceID).Str("handler", "mkcol").Logger()
if err := ValidateName(filename(r.URL.Path), s.nameValidators); err != nil {
return http.StatusBadRequest, err
}
parentRef, err := spacelookup.MakeStorageSpaceReference(spaceID, path.Dir(r.URL.Path))
if err != nil {
return http.StatusBadRequest, fmt.Errorf("invalid space id")
@@ -131,6 +131,16 @@ func (s *svc) handleSpacesMove(w http.ResponseWriter, r *http.Request, srcSpaceI
dstSpaceID, dstRelPath := router.ShiftPath(dst)
if dstRelPath != "" && dstRelPath != "." && dstRelPath != "/" {
err := ValidateDestination(filename(dstRelPath), s.nameValidators)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
b, err := errors.Marshal(http.StatusBadRequest, "destination naming rules", "", "")
errors.HandleWebdavError(appctx.GetLogger(ctx), w, b, err)
return
}
}
dstRef, err := spacelookup.MakeStorageSpaceReference(dstSpaceID, dstRelPath)
if err != nil {
w.WriteHeader(http.StatusBadRequest)