Repository navigation
Fix what the WebDAV review found - #21
Merged
Merged
Conversation
- A MOVE or COPY that replaces something no longer deletes it first: a file replaces a file in one step, as a PUT does, and anything else is set aside until the move or copy worked, and put back if it failed. With the trash off, a failed move used to lose the destination. A replaced file no longer goes to the trash either, so apps that save through a temporary file no longer fill the trash and the quota with every old version; a replaced folder still goes there. - On file systems that find names in any case, a MOVE that changes only a name's case renames it, where it used to put the file in the trash; so does the site's rename, which refused. Nested moves are judged by folded paths. - Replacing a file takes what it replaced off its home's usage, instead of counting the whole home and the trash again before the next write. - PUT, DELETE, MOVE, COPY and PROPPATCH honor If-Match and If-Unmodified-Since. - Locks belong to their users, who alone may refresh or end them; each user may hold 1,000, and an owner may be 1 KiB. Rights and the file system are checked before the lock table is held, and PROPFIND looks at it once. A lock of a free name makes an empty file (RFC 4918). - macOS's ._ files are read to the end rather than cut off at 64 KiB. - PROPPATCH of a file's time takes the right to overwrite it. - X-OC-Mtime: accepted only when the time was kept. - WebDAV's 405s list WebDAV's methods. - App-password sign-ins write last_used_at at most once a minute. - Shown times are formatted in one place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes all 15 findings from the review of the code merged since PR #17 (quotas, compose and WebDAV), most severe first.
Data safety
Overwriteno longer deletes the destination before it acts. With the trash off, a move that then failed (rights inside a folder, quota, a busy file) used to lose the destination for good. Now:renameator an atomic commit), as a PUT does.a.txttoA.txt(e.g. Finder on an APFS-served folder) used to trash the file; it now renames it. The site's rename also failed (409, as both lock files were one) and now works. The checks for moving into itself or over what holds the source compare folded paths. Linux deployments weren't affected.Correctness
If-Match/If-Unmodified-Sinceare honored by PUT (site and WebDAV), DELETE, MOVE, COPY and PROPPATCH, with strong ETag comparison (RFC 9110 §13.1).X-OC-Mtime: acceptedis sent only when the time was actually kept. A failedChtimesis logged.._files are still not kept.Allowlist instead of the site's.Locks
Efficiency
last_used_atwith the user and only write it once a minute, instead of an UPDATE on every request.Cleanup
shownTime/isoTimereplace about 10 copies of the time formatting.Testing
Allowheader.go test -race ./...with Postgres passes on macOS, exceptTestLongNonASCIIPath, which fails only on macOS (on main too). Everything passes on Linux ingolang:1.27.3-alpine.bisync --resync, then an edit and a delete,check(6 matching files), modification times kept, a server-sidemoveto, andabout. There were no server errors.🤖 Generated with Claude Code