Skip to content

Commit 9c3e06c

Browse files
authored
Merge pull request #33061 from ibpl/master-IB#1121253
Paths added to messages and message cleanup
2 parents 54da84f + 4a46c74 commit 9c3e06c

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

lib/private/Files/Node/Folder.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
/**
33
* @copyright Copyright (c) 2016, ownCloud, Inc.
4+
* @copyright Copyright (c) 2022 Informatyka Boguslawski sp. z o.o. sp.k., http://www.ib.pl/
45
*
56
* @author Arthur Schiwon <blizzz@arthur-schiwon.de>
67
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
@@ -68,7 +69,7 @@ protected function createNonExistingNode($path) {
6869
public function getFullPath($path) {
6970
$path = $this->normalizePath($path);
7071
if (!$this->isValidPath($path)) {
71-
throw new NotPermittedException('Invalid path');
72+
throw new NotPermittedException('Invalid path "' . $path . '"');
7273
}
7374
return $this->path . $path;
7475
}
@@ -163,14 +164,14 @@ public function newFolder($path) {
163164
$nonExisting = new NonExistingFolder($this->root, $this->view, $fullPath);
164165
$this->sendHooks(['preWrite', 'preCreate'], [$nonExisting]);
165166
if (!$this->view->mkdir($fullPath)) {
166-
throw new NotPermittedException('Could not create folder');
167+
throw new NotPermittedException('Could not create folder "' . $fullPath . '"');
167168
}
168169
$parent = dirname($fullPath) === $this->getPath() ? $this : null;
169170
$node = new Folder($this->root, $this->view, $fullPath, null, $parent);
170171
$this->sendHooks(['postWrite', 'postCreate'], [$node]);
171172
return $node;
172173
} else {
173-
throw new NotPermittedException('No create permission for folder');
174+
throw new NotPermittedException('No create permission for folder "' . $path . '"');
174175
}
175176
}
176177

@@ -194,13 +195,13 @@ public function newFile($path, $content = null) {
194195
$result = $this->view->touch($fullPath);
195196
}
196197
if ($result === false) {
197-
throw new NotPermittedException('Could not create path');
198+
throw new NotPermittedException('Could not create path "' . $fullPath . '"');
198199
}
199200
$node = new File($this->root, $this->view, $fullPath, null, $this);
200201
$this->sendHooks(['postWrite', 'postCreate'], [$node]);
201202
return $node;
202203
}
203-
throw new NotPermittedException('No create permission for path');
204+
throw new NotPermittedException('No create permission for path "' . $path . '"');
204205
}
205206

206207
private function queryFromOperator(ISearchOperator $operator, string $uid = null): ISearchQuery {
@@ -230,7 +231,7 @@ public function search($query) {
230231

231232
$limitToHome = $query->limitToHome();
232233
if ($limitToHome && count(explode('/', $this->path)) !== 3) {
233-
throw new \InvalidArgumentException('searching by owner is only allows on the users home folder');
234+
throw new \InvalidArgumentException('searching by owner is only allowed in the users home folder');
234235
}
235236

236237
$rootLength = strlen($this->path);
@@ -392,7 +393,7 @@ public function delete() {
392393
$nonExisting = new NonExistingFolder($this->root, $this->view, $this->path, $fileInfo);
393394
$this->sendHooks(['postDelete'], [$nonExisting]);
394395
} else {
395-
throw new NotPermittedException('No delete permission for path');
396+
throw new NotPermittedException('No delete permission for path "' . $this->path . '"');
396397
}
397398
}
398399

0 commit comments

Comments
 (0)