aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGit'Fellow <12234510+solracsf@users.noreply.github.com>2025-01-31 09:53:44 +0100
committerGit'Fellow <12234510+solracsf@users.noreply.github.com>2025-01-31 10:42:18 +0100
commita86aed915f4d7af2df37257da545d12d05e8245d (patch)
treea51afd3262f7d6f5267d8199e978b15005443703
parent566cecbcc441a479f828a78f634686934f5e16bf (diff)
downloadnextcloud-server-allowMkcolAndPut.tar.gz
nextcloud-server-allowMkcolAndPut.zip
fix(FilesDrop): MKCOL should be allowed along with PUTallowMkcolAndPut
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
-rw-r--r--apps/dav/lib/Files/Sharing/FilesDropPlugin.php4
-rw-r--r--apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php14
-rw-r--r--build/integration/filesdrop_features/filesdrop.feature13
3 files changed, 2 insertions, 29 deletions
diff --git a/apps/dav/lib/Files/Sharing/FilesDropPlugin.php b/apps/dav/lib/Files/Sharing/FilesDropPlugin.php
index 9d883be81fc..4e1f8bb0991 100644
--- a/apps/dav/lib/Files/Sharing/FilesDropPlugin.php
+++ b/apps/dav/lib/Files/Sharing/FilesDropPlugin.php
@@ -53,8 +53,8 @@ class FilesDropPlugin extends ServerPlugin {
}
// Only allow file drop
- if ($request->getMethod() !== 'PUT') {
- throw new MethodNotAllowed('Only PUT is allowed on files drop');
+ if ($request->getMethod() !== 'PUT' && $request->getMethod() !== 'MKCOL') {
+ throw new MethodNotAllowed('Only PUT or MKCOL are allowed on files drop');
}
// Always upload at the root level
diff --git a/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php b/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php
index 7264119f8c6..647de49527d 100644
--- a/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php
+++ b/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php
@@ -9,7 +9,6 @@ use OC\Files\View;
use OCA\DAV\Files\Sharing\FilesDropPlugin;
use OCP\Share\IAttributes;
use OCP\Share\IShare;
-use Sabre\DAV\Exception\MethodNotAllowed;
use Sabre\DAV\Server;
use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\ResponseInterface;
@@ -132,19 +131,6 @@ class FilesDropPluginTest extends TestCase {
$this->plugin->beforeMethod($this->request, $this->response);
}
- public function testNoMKCOL(): void {
- $this->plugin->enable();
- $this->plugin->setView($this->view);
- $this->plugin->setShare($this->share);
-
- $this->request->method('getMethod')
- ->willReturn('MKCOL');
-
- $this->expectException(MethodNotAllowed::class);
-
- $this->plugin->beforeMethod($this->request, $this->response);
- }
-
public function testNoSubdirPut(): void {
$this->plugin->enable();
$this->plugin->setView($this->view);
diff --git a/build/integration/filesdrop_features/filesdrop.feature b/build/integration/filesdrop_features/filesdrop.feature
index 2c9156dea02..d3a0e22ead1 100644
--- a/build/integration/filesdrop_features/filesdrop.feature
+++ b/build/integration/filesdrop_features/filesdrop.feature
@@ -47,19 +47,6 @@ Feature: FilesDrop
And Downloading file "/drop/a.txt"
Then Downloaded content should be "abc"
- Scenario: Files drop forbis MKCOL
- Given user "user0" exists
- And As an "user0"
- And user "user0" created a folder "/drop"
- And as "user0" creating a share with
- | path | drop |
- | shareType | 3 |
- | publicUpload | true |
- And Updating last share with
- | permissions | 4 |
- When Creating folder "folder" in drop
- Then the HTTP status code should be "405"
-
Scenario: Files request drop
Given user "user0" exists
And As an "user0"