summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files_trashbin/appinfo/info.xml2
-rw-r--r--apps/files_trashbin/composer/composer/autoload_classmap.php2
-rw-r--r--apps/files_trashbin/composer/composer/autoload_static.php2
-rw-r--r--apps/files_trashbin/composer/composer/installed.php4
-rw-r--r--apps/files_trashbin/lib/Sabre/TrashbinPlugin.php (renamed from apps/files_trashbin/lib/Sabre/PropfindPlugin.php)23
5 files changed, 25 insertions, 8 deletions
diff --git a/apps/files_trashbin/appinfo/info.xml b/apps/files_trashbin/appinfo/info.xml
index 0c690c1558e..58a6aa322c6 100644
--- a/apps/files_trashbin/appinfo/info.xml
+++ b/apps/files_trashbin/appinfo/info.xml
@@ -42,7 +42,7 @@ To prevent a user from running out of disk space, the Deleted files app will not
<collection>OCA\Files_Trashbin\Sabre\RootCollection</collection>
</collections>
<plugins>
- <plugin>OCA\Files_Trashbin\Sabre\PropfindPlugin</plugin>
+ <plugin>OCA\Files_Trashbin\Sabre\TrashbinPlugin</plugin>
</plugins>
</sabre>
diff --git a/apps/files_trashbin/composer/composer/autoload_classmap.php b/apps/files_trashbin/composer/composer/autoload_classmap.php
index 01f602448d4..88678d8a72a 100644
--- a/apps/files_trashbin/composer/composer/autoload_classmap.php
+++ b/apps/files_trashbin/composer/composer/autoload_classmap.php
@@ -27,7 +27,6 @@ return array(
'OCA\\Files_Trashbin\\Sabre\\AbstractTrashFile' => $baseDir . '/../lib/Sabre/AbstractTrashFile.php',
'OCA\\Files_Trashbin\\Sabre\\AbstractTrashFolder' => $baseDir . '/../lib/Sabre/AbstractTrashFolder.php',
'OCA\\Files_Trashbin\\Sabre\\ITrash' => $baseDir . '/../lib/Sabre/ITrash.php',
- 'OCA\\Files_Trashbin\\Sabre\\PropfindPlugin' => $baseDir . '/../lib/Sabre/PropfindPlugin.php',
'OCA\\Files_Trashbin\\Sabre\\RestoreFolder' => $baseDir . '/../lib/Sabre/RestoreFolder.php',
'OCA\\Files_Trashbin\\Sabre\\RootCollection' => $baseDir . '/../lib/Sabre/RootCollection.php',
'OCA\\Files_Trashbin\\Sabre\\TrashFile' => $baseDir . '/../lib/Sabre/TrashFile.php',
@@ -36,6 +35,7 @@ return array(
'OCA\\Files_Trashbin\\Sabre\\TrashFolderFolder' => $baseDir . '/../lib/Sabre/TrashFolderFolder.php',
'OCA\\Files_Trashbin\\Sabre\\TrashHome' => $baseDir . '/../lib/Sabre/TrashHome.php',
'OCA\\Files_Trashbin\\Sabre\\TrashRoot' => $baseDir . '/../lib/Sabre/TrashRoot.php',
+ 'OCA\\Files_Trashbin\\Sabre\\TrashbinPlugin' => $baseDir . '/../lib/Sabre/TrashbinPlugin.php',
'OCA\\Files_Trashbin\\Storage' => $baseDir . '/../lib/Storage.php',
'OCA\\Files_Trashbin\\Trash\\BackendNotFoundException' => $baseDir . '/../lib/Trash/BackendNotFoundException.php',
'OCA\\Files_Trashbin\\Trash\\ITrashBackend' => $baseDir . '/../lib/Trash/ITrashBackend.php',
diff --git a/apps/files_trashbin/composer/composer/autoload_static.php b/apps/files_trashbin/composer/composer/autoload_static.php
index 40f3310c663..440dc3ee566 100644
--- a/apps/files_trashbin/composer/composer/autoload_static.php
+++ b/apps/files_trashbin/composer/composer/autoload_static.php
@@ -42,7 +42,6 @@ class ComposerStaticInitFiles_Trashbin
'OCA\\Files_Trashbin\\Sabre\\AbstractTrashFile' => __DIR__ . '/..' . '/../lib/Sabre/AbstractTrashFile.php',
'OCA\\Files_Trashbin\\Sabre\\AbstractTrashFolder' => __DIR__ . '/..' . '/../lib/Sabre/AbstractTrashFolder.php',
'OCA\\Files_Trashbin\\Sabre\\ITrash' => __DIR__ . '/..' . '/../lib/Sabre/ITrash.php',
- 'OCA\\Files_Trashbin\\Sabre\\PropfindPlugin' => __DIR__ . '/..' . '/../lib/Sabre/PropfindPlugin.php',
'OCA\\Files_Trashbin\\Sabre\\RestoreFolder' => __DIR__ . '/..' . '/../lib/Sabre/RestoreFolder.php',
'OCA\\Files_Trashbin\\Sabre\\RootCollection' => __DIR__ . '/..' . '/../lib/Sabre/RootCollection.php',
'OCA\\Files_Trashbin\\Sabre\\TrashFile' => __DIR__ . '/..' . '/../lib/Sabre/TrashFile.php',
@@ -51,6 +50,7 @@ class ComposerStaticInitFiles_Trashbin
'OCA\\Files_Trashbin\\Sabre\\TrashFolderFolder' => __DIR__ . '/..' . '/../lib/Sabre/TrashFolderFolder.php',
'OCA\\Files_Trashbin\\Sabre\\TrashHome' => __DIR__ . '/..' . '/../lib/Sabre/TrashHome.php',
'OCA\\Files_Trashbin\\Sabre\\TrashRoot' => __DIR__ . '/..' . '/../lib/Sabre/TrashRoot.php',
+ 'OCA\\Files_Trashbin\\Sabre\\TrashbinPlugin' => __DIR__ . '/..' . '/../lib/Sabre/TrashbinPlugin.php',
'OCA\\Files_Trashbin\\Storage' => __DIR__ . '/..' . '/../lib/Storage.php',
'OCA\\Files_Trashbin\\Trash\\BackendNotFoundException' => __DIR__ . '/..' . '/../lib/Trash/BackendNotFoundException.php',
'OCA\\Files_Trashbin\\Trash\\ITrashBackend' => __DIR__ . '/..' . '/../lib/Trash/ITrashBackend.php',
diff --git a/apps/files_trashbin/composer/composer/installed.php b/apps/files_trashbin/composer/composer/installed.php
index a1f6a8636b4..7431fd7248b 100644
--- a/apps/files_trashbin/composer/composer/installed.php
+++ b/apps/files_trashbin/composer/composer/installed.php
@@ -3,7 +3,7 @@
'name' => '__root__',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
- 'reference' => 'd51429a47232bbf46a2be832ecfa711f102da802',
+ 'reference' => '3c99b642938e7810ccd05813cda96643a8ee5da5',
'type' => 'library',
'install_path' => __DIR__ . '/../',
'aliases' => array(),
@@ -13,7 +13,7 @@
'__root__' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
- 'reference' => 'd51429a47232bbf46a2be832ecfa711f102da802',
+ 'reference' => '3c99b642938e7810ccd05813cda96643a8ee5da5',
'type' => 'library',
'install_path' => __DIR__ . '/../',
'aliases' => array(),
diff --git a/apps/files_trashbin/lib/Sabre/PropfindPlugin.php b/apps/files_trashbin/lib/Sabre/TrashbinPlugin.php
index 219f236f93c..0c3ccee2590 100644
--- a/apps/files_trashbin/lib/Sabre/PropfindPlugin.php
+++ b/apps/files_trashbin/lib/Sabre/TrashbinPlugin.php
@@ -27,14 +27,16 @@ declare(strict_types=1);
*/
namespace OCA\Files_Trashbin\Sabre;
-use OCA\DAV\Connector\Sabre\FilesPlugin;
use OCP\IPreview;
use Sabre\DAV\INode;
-use Sabre\DAV\PropFind;
use Sabre\DAV\Server;
+use Sabre\DAV\PropFind;
use Sabre\DAV\ServerPlugin;
+use Sabre\HTTP\RequestInterface;
+use Sabre\HTTP\ResponseInterface;
+use OCA\DAV\Connector\Sabre\FilesPlugin;
-class PropfindPlugin extends ServerPlugin {
+class TrashbinPlugin extends ServerPlugin {
public const TRASHBIN_FILENAME = '{http://nextcloud.org/ns}trashbin-filename';
public const TRASHBIN_ORIGINAL_LOCATION = '{http://nextcloud.org/ns}trashbin-original-location';
public const TRASHBIN_DELETION_TIME = '{http://nextcloud.org/ns}trashbin-deletion-time';
@@ -56,6 +58,7 @@ class PropfindPlugin extends ServerPlugin {
$this->server = $server;
$this->server->on('propFind', [$this, 'propFind']);
+ $this->server->on('afterMethod:GET', [$this,'httpGet']);
}
@@ -110,4 +113,18 @@ class PropfindPlugin extends ServerPlugin {
return '';
});
}
+
+ /**
+ * Set real filename on trashbin download
+ *
+ * @param RequestInterface $request
+ * @param ResponseInterface $response
+ */
+ public function httpGet(RequestInterface $request, ResponseInterface $response): void {
+ $path = $request->getPath();
+ $node = $this->server->tree->getNodeForPath($path);
+ if ($node instanceof ITrash) {
+ $response->addHeader('Content-Disposition', 'attachment; filename="' . $node->getFilename() . '"');
+ }
+ }
}