Skip to content

feat: add partial update support#331

Open
janlay wants to merge 1 commit into
hacdias:mainfrom
janlay:add-partial-put-support
Open

feat: add partial update support#331
janlay wants to merge 1 commit into
hacdias:mainfrom
janlay:add-partial-put-support

Conversation

@janlay
Copy link
Copy Markdown

@janlay janlay commented May 16, 2026

Summary

Adds partial update support for WebDAV clients that require range-based writes, especially webdavfs.

This includes support for:

  • PATCH with X-Update-Range
  • PUT with Content-Range
  • advertising sabredav-partialupdate via the DAV response header
  • exposing Accept-Patch: application/x-sabredav-partialupdate

Motivation

Some WebDAV clients, such as miquels/webdavfs, probe for PUT range support before mounting read-write. Without partial update support, they fall back to read-only mode with:

no PUT Range support, mounting read-only

Advertising and implementing SabreDAV-style partial updates allows these clients to mount read-write.

Changes

  • Intercept OPTIONS to advertise partial update capability.
  • Handle partial updates before delegating to golang.org/x/net/webdav.
  • Add PATCH permission handling equivalent to PUT.
  • Add CORS defaults for PATCH, Content-Range, and X-Update-Range.
  • Add tests for:
    • OPTIONS partial update headers
    • PATCH partial writes
    • sparse partial file creation
    • PUT with Content-Range

Testing

go test ./...
go build -o webdav .

Also manually verified with webdavfs on Debian:

sudo mount -t webdavfs -o"username=user,password=pass,allow_other,rw" http://10.0.0.2:6065 /mnt/test

The mount succeeds as read-write and no longer reports missing PUT range support. A mounted-file partial overwrite test also passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant