[Pkg-owncloud-commits] [owncloud] 138/394: introduce Files.containsInvalidCharacters(), use when creating or renaming files

David Prévot taffit at alioth.debian.org
Fri Nov 8 23:11:48 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 f385d32331bd7cc5c0d4f181d32dd3aaedef234c
Author: Jörn Friedrich Dreyer <jfd at butonic.de>
Date:   Thu Nov 22 13:03:17 2012 +0100

    introduce Files.containsInvalidCharacters(), use when creating or renaming files
    
    Conflicts:
    	apps/files/js/files.js
---
 apps/files/js/filelist.js |    3 +++
 apps/files/js/files.js    |   23 ++++++++++++++---------
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index fb17825..8b83221 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -147,6 +147,9 @@ var FileList={
 			event.stopPropagation();
 			event.preventDefault();
 			var newname=input.val();
+			if (Files.containsInvalidCharacters(newname)) {
+				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 ed3aa76..609d78e 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -25,6 +25,18 @@ Files={
 			delete uploadingFiles[index];
 		});
 		procesSelection();
+	},
+	containsInvalidCharacters:function (name) {
+		var invalid_characters = ['\\', '/', '<', '>', ':', '"', '|', '?', '*'];
+		for (var i = 0; i < invalid_characters.length; i++) {
+			if (name.indexOf(invalid_characters[i]) != -1) {
+				$('#notification').text(t('files', "Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed."));
+				$('#notification').fadeIn();
+				return true;
+			}
+		}
+		$('#notification').fadeOut();
+		return false;
 	}
 };
 $(document).ready(function() {
@@ -510,15 +522,8 @@ $(document).ready(function() {
 		$(this).append(input);
 		input.focus();
 		input.change(function(){
-            if (type != 'web') {
-                var invalid_characters = ['\\', '/', '<', '>', ':', '"', '|', '?', '*'];
-                for (var i = 0; i < invalid_characters.length; i++) {
-                    if ($(this).val().indexOf(invalid_characters[i]) != -1) {
-                        $('#notification').text(t('files', "Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed."));
-                        $('#notification').fadeIn();
-                        return;
-                    }
-                }
+            if (type != 'web' && Files.containsInvalidCharacters($(this).val())) {
+                return;
             } else if( type == 'folder' && $('#dir').val() == '/' && $(this).val() == 'Shared') {
                 $('#notification').text(t('files','Invalid folder name. Usage of "Shared" is reserved by Owncloud'));
                 $('#notification').fadeIn();

-- 
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