Repository navigation
fix: use slash-separated lock paths on Windows - #344
Conversation
90ab625 to
c6db9cf
Compare
|
Rebased onto current I also added Validated locally on Windows — full suite passes, and |
|
Thanks for this PR. It seems the tests are failing though |
Normalize lock namespace keys in both single- and multi-directory resolvers so descendant locks remain effective on Windows. Add platform-aware coverage and a Windows CI job, quoting the coverage output flag so PowerShell passes it as one argument.
c6db9cf to
7002b99
Compare
|
Thanks for flagging this. The Windows job was failing before it reached the tests: PowerShell split the unquoted I rebased onto the current |
Summary
Problem
lockSystemadapts filesystem-backed users into one sharedwebdav.LockSystemnamespace. It currently usesfilepath.Joinfor that namespace.The
golang.org/x/net/webdav.LockSystemcontract requires resource names to use/separators regardless of the host OS. On Windows, an infinite-depth lock is stored under a name such as/D:\data, while a descendant is resolved as/D:\data\file.txt. The in-memory lock system therefore does not recognize the latter as a descendant of the former.This is observable in
TestServerPartialUpdateHonorsLocks/root: a tokenless partialPATCHto a descendant returned204 No Contentinstead of423 Locked.Fix
Normalize the filesystem directory with
filepath.ToSlash, then join it to the WebDAV resource name withpath.Join. This preserves the backing-directory namespace while satisfying the platform-independentLockSystempath contract.The new tests cover both direct root-lock inheritance and the shared namespace used when one user's directory is nested under another user's directory.
Testing
Run on Windows:
go test ./...go build ./...go vet ./...The test workflow now covers both
ubuntu-latest(with the race detector) andwindows-latest.Coordination
#335 also extends
locksystem.gofor multi-directory support. This PR only fixes the current single-directory path adapter. If #335 lands first, I can rebase this focused change and carry the same slash-separated invariant into its added resolver.