diff options
author | Joas Schilling <coding@schilljs.com> | 2016-12-20 09:32:47 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2016-12-20 09:32:47 +0100 |
commit | e53d0c0d69fa208def9580e6cb844567b8cb682c (patch) | |
tree | 9dbae6242f3a1f2ca1b0f252d917d38abb6ce51b /apps | |
parent | 084bddf8ae3877eb615faaa87b5240b8e1b8a5d4 (diff) | |
download | nextcloud-server-e53d0c0d69fa208def9580e6cb844567b8cb682c.tar.gz nextcloud-server-e53d0c0d69fa208def9580e6cb844567b8cb682c.zip |
Escape the name for the jquery selector
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/js/filelist.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index a8daeadfd26..c8ab8e15b70 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -1175,7 +1175,7 @@ var innernameSpan = $('<span></span>').addClass('innernametext').text(basename); if (path && path !== '/') { - var conflictingItems = this.$fileList.find('tr[data-file="' + name.replace( /(:|\.|\[|\]|,|=)/g, "\\$1") + '"]'); + var conflictingItems = this.$fileList.find('tr[data-file="' + this._jqSelEscape(name) + '"]'); if (conflictingItems.length !== 0) { if (conflictingItems.length === 1) { // Update the path on the first conflicting item @@ -1261,6 +1261,14 @@ return tr; }, + /* escape a selector expression for jQuery */ + _jqSelEscape: function (expression) { + if (expression) { + return expression.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]^`{|}~]/g, '\\$&'); + } + return null; + }, + /** * Adds an entry to the files array and also into the DOM * in a sorted manner. |