mirror of
https://github.com/nextcloud/server.git
synced 2026-04-29 18:11:41 -04:00
fix(FilesDropPlugin): Disable plugin for chunked uploads
Signed-off-by: provokateurin <kate@provokateurin.de>
This commit is contained in:
parent
0320a99ccc
commit
f4f0a1a94b
2 changed files with 12 additions and 7 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue