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
15 changes: 8 additions & 7 deletions lib/private/Files/Node/Folder.php
Original file line number Diff line number Diff line change
@@ -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>
Expand Down Expand Up @@ -67,7 +68,7 @@ protected function createNonExistingNode($path) {
*/
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);
}
Expand Down Expand Up @@ -162,14 +163,14 @@ public function newFolder($path) {
$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 . '"');
}
$parent = dirname($fullPath) === $this->getPath() ? $this : null;
$node = new Folder($this->root, $this->view, $fullPath, null, $parent);
$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 . '"');
}
}

Expand All @@ -193,13 +194,13 @@ public function newFile($path, $content = null) {
$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, null, $this);
$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 {
Expand Down Expand Up @@ -229,7 +230,7 @@ public function search($query) {

$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);
Expand Down Expand Up @@ -391,7 +392,7 @@ public function delete() {
$nonExisting = new NonExistingFolder($this->root, $this->view, $this->path, $fileInfo);
$this->sendHooks(['postDelete'], [$nonExisting]);
} else {
throw new NotPermittedException('No delete permission for path');
throw new NotPermittedException('No delete permission for path "' . $this->path . '"');
}
}

Expand Down