[Pkg-owncloud-commits] [owncloud] 267/394: backport of #1092 to stable45

David Prévot taffit at alioth.debian.org
Fri Nov 8 23:12:23 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v4.5.10
in repository owncloud.

commit 8241cfa9c445d19f06f456c80a237c9c52bd2f11
Author: Thomas Mueller <thomas.mueller at tmit.eu>
Date:   Sun Jan 6 18:05:13 2013 +0100

    backport of #1092 to stable45
---
 apps/files/ajax/rename.php |    2 +-
 apps/files/js/filelist.js  |    8 ++------
 apps/files/js/files.js     |   16 ++++++++++++++--
 3 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/apps/files/ajax/rename.php b/apps/files/ajax/rename.php
index 4544827..cb0bec3 100644
--- a/apps/files/ajax/rename.php
+++ b/apps/files/ajax/rename.php
@@ -12,7 +12,7 @@ $file = stripslashes($_GET["file"]);
 $newname = stripslashes($_GET["newname"]);
 
 // Delete
-if( OC_Files::move( $dir, $file, $dir, $newname )) {
+if( $newname !== '.' and OC_Files::move( $dir, $file, $dir, $newname )) {
 	OCP\JSON::success(array("data" => array( "dir" => $dir, "file" => $file, "newname" => $newname )));
 }
 else{
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 5b0d61d..a4cb3e6 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -147,13 +147,9 @@ var FileList={
 			event.stopPropagation();
 			event.preventDefault();
 			var newname=input.val();
-			if (Files.containsInvalidCharacters(newname)) {
+			if (!Files.isFileNameValid(newname)) {
 				return false;
-			} else if (newname.length == 0) {
-				$('#notification').text(t('files', "Name cannot be empty."));
-				$('#notification').fadeIn();
-				return false;
-			}
+            }
 			if (newname != name) {
 				if (FileList.checkName(name, newname, false)) {
 					newname = name;
diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index c0d2820..59b94f0 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -26,7 +26,19 @@ Files={
 		});
 		procesSelection();
 	},
-	containsInvalidCharacters:function (name) {
+    isFileNameValid:function (name) {
+        if (name === '.') {
+            $('#notification').text(t('files', "'.' is an invalid file name."));
+            $('#notification').fadeIn();
+            return false;
+        }
+        if (name.length == 0) {
+            $('#notification').text(t('files', "File name cannot be empty."));
+            $('#notification').fadeIn();
+            return false;
+        }
+
+        // check for invalid characters
 		var invalid_characters = ['\\', '/', '<', '>', ':', '"', '|', '?', '*'];
 		for (var i = 0; i < invalid_characters.length; i++) {
 			if (name.indexOf(invalid_characters[i]) != -1) {
@@ -527,7 +539,7 @@ $(document).ready(function() {
 			event.stopPropagation();
 			event.preventDefault();
 			var newname=input.val();
-			if(type != 'web' && Files.containsInvalidCharacters(newname)){
+			if(type != 'web' && !Files.isFileNameValid(newname)){
 				return false;
 			} else if (newname.length == 0) {
 				if(type == 'web') {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list