summaryrefslogtreecommitdiffstats
path: root/apps/files/ajax/newfile.php
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2013-10-22 18:11:03 +0200
committerJörn Friedrich Dreyer <jfd@butonic.de>2013-10-22 18:11:03 +0200
commit45e6d9670266884806431f35a4cedb80c0ceb229 (patch)
treef1826a6b1dc97cf2ee92b99f2569f1ea59112ae5 /apps/files/ajax/newfile.php
parentcadd71ec8a02fc5619a9347109f9e588e13b3e3b (diff)
downloadnextcloud-server-45e6d9670266884806431f35a4cedb80c0ceb229.tar.gz
nextcloud-server-45e6d9670266884806431f35a4cedb80c0ceb229.zip
prevent user from creating or renaming sth. to an existing filename
- show tooltip when violating naming constraints while typing - when target filename exists on server fallback to dialog to interrupt the users flow because something unexpected went wrong - fixes #5062 - also fixes some whitespace and codestyle issues in files js - uses css selector over filterAttr in touched js files
Diffstat (limited to 'apps/files/ajax/newfile.php')
-rw-r--r--apps/files/ajax/newfile.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/apps/files/ajax/newfile.php b/apps/files/ajax/newfile.php
index 76c03c87a51..8f483aa5cb6 100644
--- a/apps/files/ajax/newfile.php
+++ b/apps/files/ajax/newfile.php
@@ -56,6 +56,21 @@ function progress($notification_code, $severity, $message, $message_code, $bytes
$target = $dir.'/'.$filename;
+$l10n = \OC_L10n::get('files');
+
+if (\OC\Files\Filesystem::file_exists($target)) {
+ $result = array(
+ 'success' => false,
+ 'data' => array(
+ 'message' => $l10n->t(
+ "The name %s is already used in the folder %s. Please choose a different name.",
+ array($newname, $dir))
+ )
+ );
+ OCP\JSON::error($result);
+ exit();
+}
+
if($source) {
if(substr($source, 0, 8)!='https://' and substr($source, 0, 7)!='http://') {
OCP\JSON::error(array("data" => array( "message" => "Not a valid source" )));