aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files/Node/Folder.php
diff options
context:
space:
mode:
authorPawel Boguslawski <pawel.boguslawski@ib.pl>2022-07-01 11:16:21 +0200
committerPawel Boguslawski <pawel.boguslawski@ib.pl>2022-07-29 13:34:00 +0200
commit9eb1a92fa4baba70867b2adac8210d8f16b0822d (patch)
treec38560e08a68ac807e23688797d0115b537a9000 /lib/private/Files/Node/Folder.php
parent529d6537b25c3d7068eedbeb4b88797fe83a4e71 (diff)
downloadnextcloud-server-9eb1a92fa4baba70867b2adac8210d8f16b0822d.tar.gz
nextcloud-server-9eb1a92fa4baba70867b2adac8210d8f16b0822d.zip
Paths added to messages and message cleanup
This mod adds path to error messages. Without it it's difficult for example to find what path causes permission problems. Related: https://help.nextcloud.com/t/ocp-files-notpermittedexception-could-not-create-folder/133818 Related: https://help.nextcloud.com/t/could-not-create-folder-false-error/65962/ Author-Change-Id: IB#1121253 Signed-off-by: Pawel Boguslawski <pawel.boguslawski@ib.pl>
Diffstat (limited to 'lib/private/Files/Node/Folder.php')
-rw-r--r--lib/private/Files/Node/Folder.php15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/private/Files/Node/Folder.php b/lib/private/Files/Node/Folder.php
index 9c15f0edf41..b0df1c91293 100644
--- a/lib/private/Files/Node/Folder.php
+++ b/lib/private/Files/Node/Folder.php
@@ -1,6 +1,7 @@
<?php
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
+ * @copyright Copyright (c) 2022 Informatyka Boguslawski sp. z o.o. sp.k., http://www.ib.pl/
*
* @author Arthur Schiwon <blizzz@arthur-schiwon.de>
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
@@ -67,7 +68,7 @@ class Folder extends Node implements \OCP\Files\Folder {
*/
public function getFullPath($path) {
if (!$this->isValidPath($path)) {
- throw new NotPermittedException('Invalid path');
+ throw new NotPermittedException('Invalid path "' . $path . '"');
}
return $this->path . $this->normalizePath($path);
}
@@ -161,13 +162,13 @@ class Folder extends Node implements \OCP\Files\Folder {
$nonExisting = new NonExistingFolder($this->root, $this->view, $fullPath);
$this->sendHooks(['preWrite', 'preCreate'], [$nonExisting]);
if (!$this->view->mkdir($fullPath)) {
- throw new NotPermittedException('Could not create folder');
+ throw new NotPermittedException('Could not create folder "' . $fullPath . '"');
}
$node = new Folder($this->root, $this->view, $fullPath);
$this->sendHooks(['postWrite', 'postCreate'], [$node]);
return $node;
} else {
- throw new NotPermittedException('No create permission for folder');
+ throw new NotPermittedException('No create permission for folder "' . $path . '"');
}
}
@@ -191,13 +192,13 @@ class Folder extends Node implements \OCP\Files\Folder {
$result = $this->view->touch($fullPath);
}
if ($result === false) {
- throw new NotPermittedException('Could not create path');
+ throw new NotPermittedException('Could not create path "' . $fullPath . '"');
}
$node = new File($this->root, $this->view, $fullPath);
$this->sendHooks(['postWrite', 'postCreate'], [$node]);
return $node;
}
- throw new NotPermittedException('No create permission for path');
+ throw new NotPermittedException('No create permission for path "' . $path . '"');
}
private function queryFromOperator(ISearchOperator $operator, string $uid = null): ISearchQuery {
@@ -227,7 +228,7 @@ class Folder extends Node implements \OCP\Files\Folder {
$limitToHome = $query->limitToHome();
if ($limitToHome && count(explode('/', $this->path)) !== 3) {
- throw new \InvalidArgumentException('searching by owner is only allows on the users home folder');
+ throw new \InvalidArgumentException('searching by owner is only allowed in the users home folder');
}
$rootLength = strlen($this->path);
@@ -390,7 +391,7 @@ class Folder extends Node implements \OCP\Files\Folder {
$this->sendHooks(['postDelete'], [$nonExisting]);
$this->exists = false;
} else {
- throw new NotPermittedException('No delete permission for path');
+ throw new NotPermittedException('No delete permission for path "' . $this->path . '"');
}
}