Allow file save from Office and possibly other apps. Enforces RFC4918 section 7.6 Write Locks and COPY/MOVE lock release on move.
Some checks failed
continuous-integration/drone/push Build was killed

This commit is contained in:
2024-12-10 16:20:16 +01:00
parent c295eb69b0
commit 20a40ca1b2

View File

@@ -0,0 +1,28 @@
--- a/vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/move.go
+++ b/vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/move.go
@@ -23,6 +23,7 @@ import (
"fmt"
"net/http"
"path"
+ "time"
rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
@@ -330,6 +331,16 @@ func (s *svc) handleMove(ctx context.Context, w http.ResponseWriter, r *http.Req
return
}
+ // Discard the held lock if present
+ // Note: Specifically required by RFC4918 7.6 Write Locks and COPY/MOVE
+ if len(mReq.LockId) != 0 {
+ if err := s.LockSystem.Unlock(ctx, time.Now(), dst, mReq.LockId); err != nil {
+ log.Error().Err(err).Msg("failed to release lock after MOVE")
+ w.WriteHeader(http.StatusInternalServerError)
+ return
+ }
+ }
+
dstStatRes, err = client.Stat(ctx, dstStatReq)
if err != nil {
log.Error().Err(err).Msg("error sending grpc stat request")