Bump reva to pull in the latest fixes
This commit is contained in:
Generated
Vendored
+1
-1
@@ -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
|
||||
|
||||
Generated
Vendored
+10
-2
@@ -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
|
||||
}
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -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 {
|
||||
|
||||
Generated
Vendored
+2
-2
@@ -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{}
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user