Skip to content

feat(files): add WebDAV BDELETE for bulk deletions - #64674

Closed
BarryOfficeEU wants to merge 2 commits into
nextcloud:masterfrom
BarryOfficeEU:master
Closed

BarryOfficeEU wants to merge 2 commits into
nextcloud:masterfrom
BarryOfficeEU:master

Conversation

@BarryOfficeEU

@BarryOfficeEU BarryOfficeEU commented Sep 23, 2026 •

Copy link
Copy Markdown

Add a bounded BDELETE WebDAV method for deleting selected files in batches. Each target is deleted through the normal DAV unbind lifecycle without nested HTTP requests or mutation of the server request/response context.

Keep the feature behind bulk_delete.enabled and advertise the batch limit through capabilities so Files can fall back to individual DELETE requests when the feature is disabled or unavailable.

BDLETE-proof.mp4

Support Ticket#96104279
See also: #64611

Reviewer feedback from PR64611 addressed

1. API shape

The previous JSON POST /remote.php/dav/bulk-delete endpoint is removed. The implementation is now a WebDAV method handled by the DAV server.

2. DAV-shaped bulk deletion

The new method is BDELETE. Its request follows the Exchange-style structure:

<d:delete xmlns:d="DAV:">
   <d:target>
      <d:href>file1</d:href>
      <d:href>folder/file2</d:href>
   </d:target>

</d:delete>

The method is advertised through SabreDAV's getHTTPMethods() API. It returns 204 when every target succeeds and 207 Multi-Status when a target fails.

Reference supplied for review: Microsoft Exchange Server 2003 BDELETE documentation.

3. Request multiplexing

The old implementation created synthetic DELETE requests, changed the Sabre server's request/response/transaction state and re-entered invokeMethod() for every item. None of that remains.

BDELETE is one real DAV request. For each validated target it performs the normal unbind lifecycle directly:

  1. emit beforeUnbind
  2. delete through the DAV tree
  3. emit afterUnbind

This keeps file permission checks, storage deletion and trash handling in the existing node/storage code without repeatedly invoking request-level plugins.

Assisted-by: ChatGPT:GPT-5.6-Sol

Add a bounded BDELETE WebDAV method for deleting selected files in batches.
Each target is deleted through the normal DAV unbind lifecycle without nested
HTTP requests or mutation of the server request/response context.

Keep the feature behind bulk_delete.enabled and advertise the batch limit
through capabilities so Files can fall back to individual DELETE requests when
the feature is disabled or unavailable.

Support Ticket#96104279
See also: #64611

Assisted-by: ChatGPT:GPT-5.6-Sol
@BarryOfficeEU
BarryOfficeEU requested review from a team and skjnldsv as code owners September 23, 2026 10:29
@BarryOfficeEU
BarryOfficeEU requested review from CarlSchwan, come-nc, kristian-zendato, salmart-dev and sorbaugh and removed request for a team September 23, 2026 10:29
@BarryOfficeEU

Copy link
Copy Markdown
Author

@icewind1991 here is an updated PR that addresses your review comments from #64611

@icewind1991 icewind1991 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the existing sabre xml parsing/encoding methods instead

@icewind1991

Copy link
Copy Markdown
Member

And this is still not following the AI policy: https://github.com/nextcloud/.github/blob/master/AI_POLICY.md

Signed-off-by: Barry de Graaff <info@barrydegraaff.nl>

Signed-off-by: Barry de Graaff <info@barrydegraaff.nl>
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.

2 participants