#9934·rclone

serve webdav: failed COPY can publish a partial destination

Author: NytePlusCreated Sep 17, 2026Updated Sep 17, 2026

What is the problem you are having with rclone?

When rclone serve webdav handles a COPY, golang.org/x/net/webdav copies the source into a destination handle and then closes that handle even if reading the source failed. A streaming rclone VFS handle interprets the ordinary Close as a clean end of input, so the readable prefix can be published as the complete destination.

This affects both arbitrary source read errors and a clean EOF before the source's advertised size. For a previously missing destination, a failed COPY can therefore leave a partial file behind even though the request returned an error.

How do you think rclone should be changed to solve that?

Track completion and errors while the WebDAV COPY source handle is read. Associate that state with the corresponding destination handle and call CloseWithError rather than Close when the source did not complete successfully. This uses the VFS abort mechanism already used by serve s3 for interrupted PUT bodies.

The change should include regression coverage for an injected source read error and a source that ends before its reported size.

This issue is limited to propagating COPY source failures. Atomic replacement of an existing COPY destination is a separate concern because x/net/webdav deliberately removes an overwrite destination before copying.