aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2023-11-10 09:23:32 +0100
committerGitHub <noreply@github.com>2023-11-10 09:23:32 +0100
commita66dbcdfc1e3126e5a4efbe8655c902c3fbedf91 (patch)
tree28d4ccf2aefcf93485ba08fee0511625922c3df7 /apps
parent9de8e8e2244cfbed63f9c4d4b8abdd6092fa848c (diff)
parent0033ae52b8f57ecf201f15e12010a4099b592d86 (diff)
downloadnextcloud-server-a66dbcdfc1e3126e5a4efbe8655c902c3fbedf91.tar.gz
nextcloud-server-a66dbcdfc1e3126e5a4efbe8655c902c3fbedf91.zip
Merge pull request #41354 from nextcloud/bugfix/noid/chunking-v2-distributed-cache
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/lib/Upload/ChunkingV2Plugin.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/apps/dav/lib/Upload/ChunkingV2Plugin.php b/apps/dav/lib/Upload/ChunkingV2Plugin.php
index 97ae51fbe38..29017155d45 100644
--- a/apps/dav/lib/Upload/ChunkingV2Plugin.php
+++ b/apps/dav/lib/Upload/ChunkingV2Plugin.php
@@ -30,6 +30,8 @@ use InvalidArgumentException;
use OC\Files\Filesystem;
use OC\Files\ObjectStore\ObjectStoreStorage;
use OC\Files\View;
+use OC\Memcache\Memcached;
+use OC\Memcache\Redis;
use OC_Hook;
use OCA\DAV\Connector\Sabre\Directory;
use OCA\DAV\Connector\Sabre\File;
@@ -40,6 +42,7 @@ use OCP\Files\Storage\IChunkedFileWrite;
use OCP\Files\StorageInvalidException;
use OCP\ICache;
use OCP\ICacheFactory;
+use OCP\IConfig;
use OCP\Lock\ILockingProvider;
use Sabre\DAV\Exception\BadRequest;
use Sabre\DAV\Exception\InsufficientStorage;
@@ -272,6 +275,11 @@ class ChunkingV2Plugin extends ServerPlugin {
* @throws StorageInvalidException
*/
private function checkPrerequisites(bool $checkUploadMetadata = true): void {
+ $distributedCacheConfig = \OCP\Server::get(IConfig::class)->getSystemValue('memcache.distributed', null);
+
+ if ($distributedCacheConfig === null || (!$this->cache instanceof Redis && !$this->cache instanceof Memcached)) {
+ throw new BadRequest('Skipping chunking v2 since no proper distributed cache is available');
+ }
if (!$this->uploadFolder instanceof UploadFolder || empty($this->server->httpRequest->getHeader(self::DESTINATION_HEADER))) {
throw new BadRequest('Skipping chunked file writing as the destination header was not passed');
}
@@ -284,7 +292,7 @@ class ChunkingV2Plugin extends ServerPlugin {
if ($checkUploadMetadata) {
if ($this->uploadId === null || $this->uploadPath === null) {
- throw new PreconditionFailed('Missing metadata for chunked upload');
+ throw new PreconditionFailed('Missing metadata for chunked upload. The distributed cache does not hold the information of previous requests.');
}
}
}