aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/Files/Sharing
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dav/lib/Files/Sharing')
-rw-r--r--apps/dav/lib/Files/Sharing/FilesDropPlugin.php6
-rw-r--r--apps/dav/lib/Files/Sharing/RootCollection.php32
2 files changed, 35 insertions, 3 deletions
diff --git a/apps/dav/lib/Files/Sharing/FilesDropPlugin.php b/apps/dav/lib/Files/Sharing/FilesDropPlugin.php
index 9d883be81fc..ccf7cd28f4a 100644
--- a/apps/dav/lib/Files/Sharing/FilesDropPlugin.php
+++ b/apps/dav/lib/Files/Sharing/FilesDropPlugin.php
@@ -73,7 +73,7 @@ class FilesDropPlugin extends ServerPlugin {
if ($isFileRequest && ($nickName == null || trim($nickName) === '')) {
throw new MethodNotAllowed('Nickname is required for file requests');
}
-
+
// If this is a file request we need to create a folder for the user
if ($isFileRequest) {
// Check if the folder already exists
@@ -83,9 +83,9 @@ class FilesDropPlugin extends ServerPlugin {
// Put all files in the subfolder
$path = $nickName . '/' . $path;
}
-
+
$newName = \OC_Helper::buildNotExistingFileNameForView('/', $path, $this->view);
- $url = $request->getBaseUrl() . $newName;
+ $url = $request->getBaseUrl() . '/files/' . $this->share->getToken() . $newName;
$request->setUrl($url);
}
diff --git a/apps/dav/lib/Files/Sharing/RootCollection.php b/apps/dav/lib/Files/Sharing/RootCollection.php
new file mode 100644
index 00000000000..dd585fbb59b
--- /dev/null
+++ b/apps/dav/lib/Files/Sharing/RootCollection.php
@@ -0,0 +1,32 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace OCA\DAV\Files\Sharing;
+
+use Sabre\DAV\INode;
+use Sabre\DAVACL\AbstractPrincipalCollection;
+use Sabre\DAVACL\PrincipalBackend\BackendInterface;
+
+class RootCollection extends AbstractPrincipalCollection {
+ public function __construct(
+ private INode $root,
+ BackendInterface $principalBackend,
+ string $principalPrefix = 'principals',
+ ) {
+ parent::__construct($principalBackend, $principalPrefix);
+ }
+
+ public function getChildForPrincipal(array $principalInfo): INode {
+ return $this->root;
+ }
+
+ public function getName() {
+ return 'files';
+ }
+}