summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-01-17 18:40:11 -0600
committerGitHub <noreply@github.com>2017-01-17 18:40:11 -0600
commit08cdcf8f7f8c60a8174899a5a4ba4f14aa73552a (patch)
treeccdc542ebdb9df1fb8224032d6b2282778c8c5b9
parent4009d3db037a672fc82948dd8f209ff0810b6520 (diff)
parente53d0c0d69fa208def9580e6cb844567b8cb682c (diff)
downloadnextcloud-server-08cdcf8f7f8c60a8174899a5a4ba4f14aa73552a.tar.gz
nextcloud-server-08cdcf8f7f8c60a8174899a5a4ba4f14aa73552a.zip
Merge pull request #2776 from nextcloud/prevent-quotes-from-being-a-problem
Escape the name for the jquery selector
-rw-r--r--apps/files/js/filelist.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index cd0eb390ee3..bb50814dfdc 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -1180,7 +1180,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
@@ -1266,6 +1266,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.