mirror of
https://github.com/nextcloud/server.git
synced 2026-05-25 02:34:12 -04:00
Merge pull request #59944 from nextcloud/backport/59864/stable27
[stable27] fix(dav): do not list intermediate files
This commit is contained in:
commit
6e5e393f0a
3 changed files with 15 additions and 4 deletions
|
|
@ -46,6 +46,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;
|
||||
|
|
@ -84,14 +85,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;
|
||||
}
|
||||
|
||||
public 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
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ class RootCollection extends AbstractPrincipalCollection {
|
|||
CleanupService $cleanupService) {
|
||||
parent::__construct($principalBackend, $principalPrefix);
|
||||
$this->cleanupService = $cleanupService;
|
||||
$this->disableListing = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ use OC\Files\Filesystem;
|
|||
use OC\Files\View;
|
||||
use OCA\DAV\Connector\Sabre\Directory;
|
||||
use Sabre\DAV\Exception\Forbidden;
|
||||
use Sabre\DAV\Exception\MethodNotAllowed;
|
||||
use Sabre\DAV\ICollection;
|
||||
|
||||
class UploadHome implements ICollection {
|
||||
|
|
@ -58,9 +59,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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue