Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(trashbin): Fix errors in the log on MOVE operations
dirname will return '.' for files at the root, which will cause an
 Exception that gets logged.
Instead use \Sabre\Uri\split like other sabre plugins, to get an empty
 string for root directory.

Signed-off-by: Côme Chilliet <[email protected]>
  • Loading branch information
come-nc authored and backportbot[bot] committed Aug 28, 2025
commit 7e401c80f1e9174fc09331cd0bba1e5a1720b06d
4 changes: 3 additions & 1 deletion apps/files_trashbin/lib/Sabre/TrashbinPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Sabre\DAV\ServerPlugin;
use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\ResponseInterface;
use Sabre\Uri;

class TrashbinPlugin extends ServerPlugin {
public const TRASHBIN_FILENAME = '{http://nextcloud.org/ns}trashbin-filename';
Expand Down Expand Up @@ -146,7 +147,8 @@ public function httpGet(RequestInterface $request, ResponseInterface $response):
public function beforeMove(string $sourcePath, string $destinationPath): bool {
try {
$node = $this->server->tree->getNodeForPath($sourcePath);
$destinationNodeParent = $this->server->tree->getNodeForPath(dirname($destinationPath));
[$destinationDir, ] = Uri\split($destinationPath);
$destinationNodeParent = $this->server->tree->getNodeForPath($destinationDir);
} catch (\Sabre\DAV\Exception $e) {
\OCP\Server::get(LoggerInterface::class)
->error($e->getMessage(), ['app' => 'files_trashbin', 'exception' => $e]);
Expand Down
Loading