Skip to content

Commit

Permalink
Backward compatible WebDAV lock token HTTP header (ie. for Windows)
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-vanicek committed Nov 25, 2024
1 parent 8ffaada commit 8a9f0cb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/http/services/owncloud/ocdav/locks.go
Original file line number Diff line number Diff line change
Expand Up @@ -649,5 +649,9 @@ func (s *svc) unlockReference(ctx context.Context, _ http.ResponseWriter, r *htt
}

func requestLockToken(r *http.Request) string {
return strings.TrimSuffix(strings.TrimPrefix(r.Header.Get(net.HeaderLockToken), "<"), ">")
h := r.Header.Get(net.HeaderLockToken)
if len(h) == 0 {
h = strings.TrimSuffix(strings.TrimPrefix(r.Header.Get(net.HeaderIf), "("), ")")
}
return strings.TrimSuffix(strings.TrimPrefix(h, "<"), ">")
}

0 comments on commit 8a9f0cb

Please sign in to comment.