Merge pull request #59863 from nextcloud/backport/59780/stable30

[stable30] fix(dav): do not list intermediate files
This commit is contained in:
Stephan Orbaugh 2026-04-28 16:02:24 +02:00 committed by GitHub
commit 2f2cb04569
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 16 additions and 4 deletions

View file

@ -56,6 +56,7 @@ jobs:
with:
persist-credentials: false
repository: nextcloud/user_saml
ref: stable-6
path: apps/user_saml
ref: 'stable-7'

View file

@ -29,6 +29,7 @@ use OCP\IConfig;
use OCP\Lock\ILockingProvider;
use Sabre\DAV\Exception\BadRequest;
use Sabre\DAV\Exception\InsufficientStorage;
use Sabre\DAV\Exception\MethodNotAllowed;
use Sabre\DAV\Exception\NotFound;
use Sabre\DAV\Exception\PreconditionFailed;
use Sabre\DAV\ICollection;
@ -67,14 +68,24 @@ class ChunkingV2Plugin extends ServerPlugin {
* @inheritdoc
*/
public function initialize(Server $server) {
$server->on('afterMethod:MKCOL', [$this, 'afterMkcol']);
$server->on('beforeMethod:GET', $this->beforeGet(...));
$server->on('beforeMethod:PUT', [$this, 'beforePut']);
$server->on('beforeMethod:DELETE', [$this, 'beforeDelete']);
$server->on('beforeMove', [$this, 'beforeMove'], 90);
$server->on('afterMethod:MKCOL', [$this, 'afterMkcol']);
$this->server = $server;
}
protected function beforeGet(RequestInterface $request) {
$sourceNode = $this->server->tree->getNodeForPath($request->getPath());
if (($sourceNode instanceof FutureFile) || ($sourceNode instanceof UploadFile)) {
throw new MethodNotAllowed('Reading intermediate uploads is not allowed');
}
return true;
}
/**
* @param string $path
* @param bool $createIfNotExists

View file

@ -24,6 +24,7 @@ class RootCollection extends AbstractPrincipalCollection {
private IUserSession $userSession,
) {
parent::__construct($principalBackend, $principalPrefix);
$this->disableListing = true;
}
/**

View file

@ -14,6 +14,7 @@ use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
use OCP\IUserSession;
use Sabre\DAV\Exception\Forbidden;
use Sabre\DAV\Exception\MethodNotAllowed;
use Sabre\DAV\ICollection;
class UploadHome implements ICollection {
@ -43,9 +44,7 @@ class UploadHome implements ICollection {
}
public function getChildren(): array {
return array_map(function ($node) {
return new UploadFolder($node, $this->cleanupService, $this->getStorage());
}, $this->impl()->getChildren());
throw new MethodNotAllowed('Listing members of this collection is disabled');
}
public function childExists($name): bool {