From cde80c14d3da27a9236678b0d686e6f630999ecb Mon Sep 17 00:00:00 2001 From: provokateurin Date: Wed, 15 Oct 2025 23:22:40 +0200 Subject: [PATCH] fix(FilesDropPlugin): Disable plugin for chunked uploads Signed-off-by: provokateurin --- apps/dav/lib/Files/Sharing/FilesDropPlugin.php | 12 ++++++++++++ .../tests/unit/Files/Sharing/FilesDropPluginTest.php | 7 ------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/apps/dav/lib/Files/Sharing/FilesDropPlugin.php b/apps/dav/lib/Files/Sharing/FilesDropPlugin.php index a3dbd32ce6b..92e6159114f 100644 --- a/apps/dav/lib/Files/Sharing/FilesDropPlugin.php +++ b/apps/dav/lib/Files/Sharing/FilesDropPlugin.php @@ -42,6 +42,10 @@ class FilesDropPlugin extends ServerPlugin { } public function onMkcol(RequestInterface $request, ResponseInterface $response) { + if ($this->isChunkedUpload($request)) { + return; + } + if (!$this->enabled || $this->share === null) { return; } @@ -58,7 +62,15 @@ class FilesDropPlugin extends ServerPlugin { return false; } + private function isChunkedUpload(RequestInterface $request): bool { + return str_starts_with(substr($request->getUrl(), strlen($request->getBaseUrl()) - 1), '/uploads/'); + } + public function beforeMethod(RequestInterface $request, ResponseInterface $response) { + if ($this->isChunkedUpload($request)) { + return; + } + if (!$this->enabled || $this->share === null) { return; } diff --git a/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php b/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php index 1a7ab7179e1..2b9864be8d9 100644 --- a/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php +++ b/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php @@ -56,13 +56,6 @@ class FilesDropPluginTest extends TestCase { ->willReturn('token'); } - public function testNotEnabled(): void { - $this->request->expects($this->never()) - ->method($this->anything()); - - $this->plugin->beforeMethod($this->request, $this->response); - } - public function testValid(): void { $this->plugin->enable(); $this->plugin->setShare($this->share);