From bf7b80b7cb880519bd483fb8b072b57919e193c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Duffeck?= Date: Tue, 17 Jun 2025 10:20:07 +0200 Subject: [PATCH] Bump reva to pull in the latest fixes --- go.mod | 2 +- go.sum | 4 ++-- .../internal/http/services/owncloud/ocdav/delete.go | 2 +- .../internal/http/services/owncloud/ocdav/locks.go | 12 ++++++++++-- .../v2/internal/http/services/owncloud/ocdav/move.go | 2 +- .../http/services/owncloud/ocdav/proppatch.go | 4 ++-- .../v2/internal/http/services/owncloud/ocdav/put.go | 2 +- vendor/modules.txt | 2 +- 8 files changed, 19 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index ec80d80a3..771dfa7cb 100644 --- a/go.mod +++ b/go.mod @@ -64,7 +64,7 @@ require ( github.com/onsi/gomega v1.37.0 github.com/open-policy-agent/opa v1.5.1 github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20250603072916-fa601fb14450 - github.com/opencloud-eu/reva/v2 v2.33.2-0.20250612080213-85468735dbd6 + github.com/opencloud-eu/reva/v2 v2.33.2-0.20250617081629-b8210a01030e github.com/orcaman/concurrent-map v1.0.0 github.com/pkg/errors v0.9.1 github.com/pkg/xattr v0.4.11 diff --git a/go.sum b/go.sum index 741561ffd..939d85703 100644 --- a/go.sum +++ b/go.sum @@ -869,8 +869,8 @@ github.com/opencloud-eu/go-micro-plugins/v4/store/nats-js-kv v0.0.0-202505121527 github.com/opencloud-eu/go-micro-plugins/v4/store/nats-js-kv v0.0.0-20250512152754-23325793059a/go.mod h1:pjcozWijkNPbEtX5SIQaxEW/h8VAVZYTLx+70bmB3LY= github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20250603072916-fa601fb14450 h1:QWn9G2f1R/EbyZSbkjtd9jqNq9X0NIphmmD4KYLNZtA= github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20250603072916-fa601fb14450/go.mod h1:pzatilMEHZFT3qV7C/X3MqOa3NlRQuYhlRhZTL+hN6Q= -github.com/opencloud-eu/reva/v2 v2.33.2-0.20250612080213-85468735dbd6 h1:9NUMVWfrRIJtm41kPNc4bXjCsaIyerumuMx3rnFYNro= -github.com/opencloud-eu/reva/v2 v2.33.2-0.20250612080213-85468735dbd6/go.mod h1:o3ilVD4jpf3v6nk2oG9D7rCh/TRVEBAUOzH9z83d+Yc= +github.com/opencloud-eu/reva/v2 v2.33.2-0.20250617081629-b8210a01030e h1:NGAlzzIwtWBBHON+jyXlLwAlIe2v9PVpT90qSu+qLeA= +github.com/opencloud-eu/reva/v2 v2.33.2-0.20250617081629-b8210a01030e/go.mod h1:ky99pvvufLA7wxDHo5RoImfm4H9QqSyvZAHPkcdFTi8= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= diff --git a/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/delete.go b/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/delete.go index 7c3fe3e0d..8bb0f3053 100644 --- a/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/delete.go +++ b/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/delete.go @@ -63,7 +63,7 @@ func (s *svc) handleDelete(ctx context.Context, w http.ResponseWriter, r *http.R req := &provider.DeleteRequest{ Ref: ref, - LockId: requestLockToken(r), + LockId: requestLock(r), } // FIXME the lock token is part of the application level protocol, it should be part of the DeleteRequest message not the opaque diff --git a/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/locks.go b/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/locks.go index 28c97d420..e893ad361 100644 --- a/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/locks.go +++ b/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/locks.go @@ -26,6 +26,7 @@ import ( "io" "net/http" "path" + "regexp" "strconv" "strings" "time" @@ -61,6 +62,8 @@ import ( // we stick to the recommendation and use the URN Namespace const lockTokenPrefix = "urn:uuid:" +var requestLockRegex = regexp.MustCompile(`\(<(urn:uuid:[0-9a-fA-F-]+)>\)`) + // TODO(jfd) implement lock // see Web Distributed Authoring and Versioning (WebDAV) Locking Protocol: // https://www.greenbytes.de/tech/webdav/draft-reschke-webdav-locking-latest.html @@ -694,6 +697,11 @@ func (s *svc) unlockReference(ctx context.Context, _ http.ResponseWriter, r *htt return http.StatusInternalServerError, err } -func requestLockToken(r *http.Request) string { - return strings.TrimSuffix(strings.TrimPrefix(r.Header.Get(net.HeaderLockToken), "<"), ">") +func requestLock(r *http.Request) string { + matches := requestLockRegex.FindStringSubmatch(r.Header.Get(net.HeaderIf)) + if len(matches) < 2 { + return "" + } + + return matches[1] // the first match is the whole string, the second is the token } diff --git a/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/move.go b/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/move.go index 14ee6aa7a..fc179fd8e 100644 --- a/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/move.go +++ b/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/move.go @@ -297,7 +297,7 @@ func (s *svc) handleMove(ctx context.Context, w http.ResponseWriter, r *http.Req mReq := &provider.MoveRequest{ Source: src, Destination: dst, - LockId: requestLockToken(r), + LockId: requestLock(r), } mRes, err := client.Move(ctx, mReq) if err != nil { diff --git a/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/proppatch.go b/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/proppatch.go index d7b1f9028..80ffdd0db 100644 --- a/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/proppatch.go +++ b/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/proppatch.go @@ -133,14 +133,14 @@ func (s *svc) handleProppatch(ctx context.Context, w http.ResponseWriter, r *htt rreq := &provider.UnsetArbitraryMetadataRequest{ Ref: ref, ArbitraryMetadataKeys: []string{""}, - LockId: requestLockToken(r), + LockId: requestLock(r), } sreq := &provider.SetArbitraryMetadataRequest{ Ref: ref, ArbitraryMetadata: &provider.ArbitraryMetadata{ Metadata: map[string]string{}, }, - LockId: requestLockToken(r), + LockId: requestLock(r), } acceptedProps := []xml.Name{} diff --git a/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/put.go b/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/put.go index 17984855c..f801eb179 100644 --- a/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/put.go +++ b/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/put.go @@ -276,7 +276,7 @@ func (s *svc) handlePut(ctx context.Context, w http.ResponseWriter, r *http.Requ uReq := &provider.InitiateFileUploadRequest{ Ref: ref, Opaque: opaque, - LockId: requestLockToken(r), + LockId: requestLock(r), } if ifMatch := r.Header.Get(net.HeaderIfMatch); ifMatch != "" { uReq.Options = &provider.InitiateFileUploadRequest_IfMatch{IfMatch: ifMatch} diff --git a/vendor/modules.txt b/vendor/modules.txt index 3877d0772..6c5d96575 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1210,7 +1210,7 @@ github.com/open-policy-agent/opa/v1/version # github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20250603072916-fa601fb14450 ## explicit; go 1.18 github.com/opencloud-eu/libre-graph-api-go -# github.com/opencloud-eu/reva/v2 v2.33.2-0.20250612080213-85468735dbd6 +# github.com/opencloud-eu/reva/v2 v2.33.2-0.20250617081629-b8210a01030e ## explicit; go 1.24.1 github.com/opencloud-eu/reva/v2/cmd/revad/internal/grace github.com/opencloud-eu/reva/v2/cmd/revad/runtime