chore:reva bump v.2.32 (#737)
This commit is contained in:
Generated
Vendored
+2
-2
@@ -56,7 +56,7 @@ func (s *svc) handlePathCopy(w http.ResponseWriter, r *http.Request, ns string)
|
||||
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(r.Context(), "copy")
|
||||
defer span.End()
|
||||
|
||||
if r.Body != http.NoBody {
|
||||
if !isBodyEmpty(r) {
|
||||
w.WriteHeader(http.StatusUnsupportedMediaType)
|
||||
b, err := errors.Marshal(http.StatusUnsupportedMediaType, "body must be empty", "", "")
|
||||
errors.HandleWebdavError(appctx.GetLogger(ctx), w, b, err)
|
||||
@@ -331,7 +331,7 @@ func (s *svc) handleSpacesCopy(w http.ResponseWriter, r *http.Request, spaceID s
|
||||
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(r.Context(), "spaces_copy")
|
||||
defer span.End()
|
||||
|
||||
if r.Body != http.NoBody {
|
||||
if !isBodyEmpty(r) {
|
||||
w.WriteHeader(http.StatusUnsupportedMediaType)
|
||||
b, err := errors.Marshal(http.StatusUnsupportedMediaType, "body must be empty", "", "")
|
||||
errors.HandleWebdavError(appctx.GetLogger(ctx), w, b, err)
|
||||
|
||||
Generated
Vendored
+2
-2
@@ -39,7 +39,7 @@ func (s *svc) handlePathDelete(w http.ResponseWriter, r *http.Request, ns string
|
||||
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(ctx, "path_delete")
|
||||
defer span.End()
|
||||
|
||||
if r.Body != http.NoBody {
|
||||
if !isBodyEmpty(r) {
|
||||
return http.StatusUnsupportedMediaType, errors.New("body must be empty")
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ func (s *svc) handleSpacesDelete(w http.ResponseWriter, r *http.Request, spaceID
|
||||
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(ctx, "spaces_delete")
|
||||
defer span.End()
|
||||
|
||||
if r.Body != http.NoBody {
|
||||
if !isBodyEmpty(r) {
|
||||
return http.StatusUnsupportedMediaType, errors.New("body must be empty")
|
||||
}
|
||||
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -107,7 +107,7 @@ func (s *svc) handleSpacesMkCol(w http.ResponseWriter, r *http.Request, spaceID
|
||||
}
|
||||
|
||||
func (s *svc) handleMkcol(ctx context.Context, w http.ResponseWriter, r *http.Request, parentRef, childRef *provider.Reference, log zerolog.Logger) (status int, err error) {
|
||||
if r.Body != http.NoBody {
|
||||
if !isBodyEmpty(r) {
|
||||
// We currently do not support extended mkcol https://datatracker.ietf.org/doc/rfc5689/
|
||||
// TODO let clients send a body with properties to set on the new resource
|
||||
return http.StatusUnsupportedMediaType, fmt.Errorf("extended-mkcol not supported")
|
||||
|
||||
Generated
Vendored
+2
-2
@@ -42,7 +42,7 @@ func (s *svc) handlePathMove(w http.ResponseWriter, r *http.Request, ns string)
|
||||
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(r.Context(), "move")
|
||||
defer span.End()
|
||||
|
||||
if r.Body != http.NoBody {
|
||||
if !isBodyEmpty(r) {
|
||||
w.WriteHeader(http.StatusUnsupportedMediaType)
|
||||
b, err := errors.Marshal(http.StatusUnsupportedMediaType, "body must be empty", "", "")
|
||||
errors.HandleWebdavError(appctx.GetLogger(ctx), w, b, err)
|
||||
@@ -106,7 +106,7 @@ func (s *svc) handleSpacesMove(w http.ResponseWriter, r *http.Request, srcSpaceI
|
||||
ctx, span := appctx.GetTracerProvider(r.Context()).Tracer(tracerName).Start(r.Context(), "spaces_move")
|
||||
defer span.End()
|
||||
|
||||
if r.Body != http.NoBody {
|
||||
if !isBodyEmpty(r) {
|
||||
w.WriteHeader(http.StatusUnsupportedMediaType)
|
||||
b, err := errors.Marshal(http.StatusUnsupportedMediaType, "body must be empty", "", "")
|
||||
errors.HandleWebdavError(appctx.GetLogger(ctx), w, b, err)
|
||||
|
||||
Generated
Vendored
+15
@@ -20,6 +20,7 @@ package ocdav
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
"path"
|
||||
"strings"
|
||||
@@ -399,3 +400,17 @@ func (s *svc) referenceIsChildOf(ctx context.Context, selector pool.Selectable[g
|
||||
func filename(p string) string {
|
||||
return strings.Trim(path.Base(p), "/")
|
||||
}
|
||||
|
||||
// isBodyEmpty returns true when the Body of the request is Empty
|
||||
func isBodyEmpty(r *http.Request) bool {
|
||||
if r.Body != nil && r.Body != http.NoBody {
|
||||
buf := make([]byte, 0)
|
||||
_, err := r.Body.Read(buf)
|
||||
if err != io.EOF {
|
||||
// We currently do not support extended mkcol https://datatracker.ietf.org/doc/rfc5689/
|
||||
// TODO let clients send a body with properties to set on the new resource
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user