WebDAV: in-flight upload temp files (.cairn-upload-*) appear in PROPFIND listings #495
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Cordy/Cairn#495
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Status: verified at runtime against cairnd built from
bd006ef; unchanged onmain(e1c855d).What happens
While a
PUTis streaming, the posix driver's temp file sits in the target directory (internal/storage/posix/posix.go:156,CreateTemp) and is listed by PROPFIND. Observed during a rate-limited 3 MB PUT:After the upload completes, the listing shows
slow.binand the temp entry is gone.Impact
Every other client sees a half-written file appear and vanish. A sync client may download the partial bytes, or later read its disappearance as a delete; a user may open or delete it. cairn-desktop now skips
.cairn-upload-*names (its ruling P2-R14), but other WebDAV clients (Finder, rclone, mobile apps) will not.Suggested fix
Filter the prefix out of List and Stat and add it to the reserved names (
internal/storage/reserved/reserved.go) so users cannot create it — or stage temp files in a hidden spool directory on the same filesystem and rename into place.Found while building the cairn-desktop WebDAV client (phase 2, Cordy/cairn-desktop#22). Filed by Claude on behalf of @Cordy.
Shipped in v0.6.169, live on both dogfoods.
What landed in the posix driver:
.cairn-upload-*(and.cairn-replace-*staging names from #496) are now invisible to every read path:Listskips them,Stat/Openon such a name →ErrNotFound.Write/Mkdiron a hidden name →ErrInvalidPath. The driver's own temp files bypass the guard viaos.Rootdirectly, so uploads are unaffected.copyFilewas made atomic on the way through (temp + rename, same retry loop asWrite), so COPY no longer exposes half-written destinations.TDD:
temp_test.gofixtures plant stray temp files viaosdirectly and assert invisibility — witnessed red first. Orphaned temps from a crashed upload no longer surface in listings, WebDAV PROPFINDs, or sync clients.