fix: break server-side locks via X-User-Lock, map 423 to EBUSY #4

Merged
troed merged 1 commit from fix-lock-unlock into main 2026-08-07 15:19:11 +02:00
Owner

Fixes deletion of files locked by the Nextcloud Text app (or any other lock owner).

Problem

rm on a server-locked file returned EIO. Nextcloud's files_lock app stores a permanent stale lock (lock_timeout=-1, never expires) owned by the Text app; a plain WebDAV UNLOCK is rejected (UnauthorizedUnlockException) because the lock owner isn't the WebDAV session user.

Fix

  1. webdav.rs break_lock: send X-User-Lock: 1 on the UNLOCK. The files_lock LockPlugin honors this header and enables a user-override, allowing the file owner to break any lock.
  2. map_api_error_to_fuse: map HTTP 423 to EBUSY instead of the EIO catch-all.

Test plan

  • cargo test --lib: 108 passed (4 new tests, incl. a mockito UNLOCK-header test that is mutation-verified to catch a missing header).
  • Live test on this machine: deleted Empty file.md (locked by Text app since 2026-07-31); journal shows Successfully broke lock and the file was removed from the mount.
Fixes deletion of files locked by the Nextcloud Text app (or any other lock owner). ## Problem `rm` on a server-locked file returned EIO. Nextcloud's files_lock app stores a permanent stale lock (lock_timeout=-1, never expires) owned by the Text app; a plain WebDAV UNLOCK is rejected (UnauthorizedUnlockException) because the lock owner isn't the WebDAV session user. ## Fix 1. **webdav.rs break_lock**: send `X-User-Lock: 1` on the UNLOCK. The files_lock LockPlugin honors this header and enables a user-override, allowing the file owner to break any lock. 2. **map_api_error_to_fuse**: map HTTP 423 to EBUSY instead of the EIO catch-all. ## Test plan - `cargo test --lib`: 108 passed (4 new tests, incl. a mockito UNLOCK-header test that is mutation-verified to catch a missing header). - Live test on this machine: deleted `Empty file.md` (locked by Text app since 2026-07-31); journal shows `Successfully broke lock` and the file was removed from the mount.
troed force-pushed fix-lock-unlock from b9b9776cea to 631c112bac 2026-08-07 15:18:53 +02:00 Compare
troed merged commit f4acb34815 into main 2026-08-07 15:19:11 +02:00
troed deleted branch fix-lock-unlock 2026-08-07 15:19:11 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
troed/nextcloud-fuse!4
No description provided.