mirror of
https://github.com/nextcloud/server.git
synced 2026-06-13 10:40:40 -04:00
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 <come.chilliet@nextcloud.com>
This commit is contained in:
parent
0570ce9ec3
commit
fdd80f8ab4
1 changed files with 3 additions and 1 deletions
|
|
@ -20,6 +20,7 @@ use Sabre\DAV\Server;
|
|||
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';
|
||||
|
|
@ -145,7 +146,8 @@ class TrashbinPlugin extends ServerPlugin {
|
|||
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]);
|
||||
|
|
|
|||
Loading…
Reference in a new issue