summaryrefslogtreecommitdiffstats
path: root/apps/files/lib
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-05-29 19:30:09 +0200
committerVincent Petry <pvince81@owncloud.com>2015-05-29 19:30:09 +0200
commit13617c8bf10ed8e991757099e95da060612e7787 (patch)
tree98342fc0ef034ccdd4b77d7c4c6c17eef5e888e4 /apps/files/lib
parent01a241f71129c3980619f3981d3f7903c1a4cee8 (diff)
downloadnextcloud-server-13617c8bf10ed8e991757099e95da060612e7787.tar.gz
nextcloud-server-13617c8bf10ed8e991757099e95da060612e7787.zip
Check target name on rename with web UI
When renaming over the web UI, check early that the target name is valid. This prevents nonsensical error messages when renaming to a name with a trailing backslash.
Diffstat (limited to 'apps/files/lib')
-rw-r--r--apps/files/lib/app.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/apps/files/lib/app.php b/apps/files/lib/app.php
index d80024f2470..5bd8c127586 100644
--- a/apps/files/lib/app.php
+++ b/apps/files/lib/app.php
@@ -74,6 +74,17 @@ class App {
'data' => NULL
);
+ try {
+ // check if the new name is conform to file name restrictions
+ $this->view->verifyPath($dir, $newname);
+ } catch (\OCP\Files\InvalidPathException $ex) {
+ $result['data'] = array(
+ 'message' => $this->l10n->t($ex->getMessage()),
+ 'code' => 'invalidname',
+ );
+ return $result;
+ }
+
$normalizedOldPath = \OC\Files\Filesystem::normalizePath($dir . '/' . $oldname);
$normalizedNewPath = \OC\Files\Filesystem::normalizePath($dir . '/' . $newname);