mirror of
https://github.com/nextcloud/server.git
synced 2026-10-23 11:15:48 +02:00
ChunkingV2Plugin::beforeGet eagerly resolves the request path during beforeMethod:GET to block reading intermediate chunked uploads. App-provided DAV collections (versions, trashbin) are attached to the root lazily in a beforeMethod:* closure in Server.php, while uploads is registered eagerly. When beforeGet runs before that closure, getNodeForPath() throws NotFound and aborts the whole request, turning every GET under /dav/versions/ and /dav/trashbin/ into "404 File not found: versions in 'root'". PROPFIND is unaffected, since nothing resolves the path that early for it. This does not currently surface on master only by accident of listener ordering: beforeGet and the collection closure share the default priority, and because beforeGet is registered as a first-class callable (a Closure), the wildcard closure happens to sort before it, so the collections are already attached by the time beforeGet resolves the path. That ordering is not guaranteed -- it depends on how equal-priority listeners are tie-broken -- so the unguarded resolution is a latent fault that any reordering can expose. On stable 28 it is already broken, because the backport registered the handler as an array callable, which tie-breaks the other way and runs beforeGet first. Catch NotFound in beforeGet and bail out: a path that cannot be resolved is by definition not an intermediate upload. This removes the dependency on listener ordering entirely and makes the handler consistent with beforePut()/beforeMove()/beforeDelete(), which already swallow NotFound for the same reason. Add a ChunkingV2Plugin unit test (the NotFound case is the regression guard) and a file-versions integration scenario covering a real version download. Assisted-by: ClaudeCode:claude-opus-4-8[1m] Signed-off-by: David Dreschner <david.dreschner@nextcloud.com>
18 lines
1.0 KiB
Gherkin
18 lines
1.0 KiB
Gherkin
# SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
Feature: file-versions
|
|
Background:
|
|
Given using new dav path
|
|
|
|
# Regression test for file version downloads returning "404 File not found: versions in 'root'".
|
|
# The versions/trash bin collections are attached to the DAV root lazily during beforeMethod,
|
|
# so an early GET handler that resolved the request path too eagerly aborted the request.
|
|
# This exercises the full plugin stack: a real previous version must be downloadable via DAV.
|
|
Scenario: Download a previous version of a file via the versions DAV endpoint
|
|
Given user "admin" uploads file with content "first version" and mtime "1111111111" to "/versioned.txt"
|
|
And user "admin" uploads file with content "second version" and mtime "2222222222" to "/versioned.txt"
|
|
When user "admin" downloads version "1111111111" of file "/versioned.txt"
|
|
Then the HTTP status code should be "200"
|
|
And Downloaded content should be "first version"
|