diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-01-29 10:02:23 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-01-29 10:02:23 +0100 |
commit | 4070657875f0d98abf15f3fdcb50a173e9e087ce (patch) | |
tree | de8847a5050ccccb852d67a46fa632be777c884b /core | |
parent | 2b185b73e283de0e32b9991d302c4270ccaee158 (diff) | |
parent | c925bfdcd6b3c930ba26ed61a6e94d203fedca9a (diff) | |
download | nextcloud-server-4070657875f0d98abf15f3fdcb50a173e9e087ce.tar.gz nextcloud-server-4070657875f0d98abf15f3fdcb50a173e9e087ce.zip |
Merge pull request #21981 from owncloud/systemtags-trim-name
Trim tag names to avoid problems
Diffstat (limited to 'core')
-rw-r--r-- | core/js/systemtags/systemtagsinputfield.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/core/js/systemtags/systemtagsinputfield.js b/core/js/systemtags/systemtagsinputfield.js index 461b52d88e9..48fc98c6188 100644 --- a/core/js/systemtags/systemtagsinputfield.js +++ b/core/js/systemtags/systemtagsinputfield.js @@ -133,7 +133,7 @@ cid: this.cid, name: oldName, deleteTooltip: t('core', 'Delete'), - renameLabel: t('core', 'Rename'), + renameLabel: t('core', 'Rename') })); $item.find('.label').after($renameForm); $item.find('.label, .systemtags-actions').addClass('hidden'); @@ -160,7 +160,7 @@ var $item = $form.closest('.systemtags-item'); var tagId = $item.attr('data-id'); var tagModel = this.collection.get(tagId); - var newName = $(ev.target).find('input').val(); + var newName = $(ev.target).find('input').val().trim(); if (newName && newName !== tagModel.get('name')) { tagModel.save({'name': newName}); // TODO: spinner, and only change text after finished saving @@ -204,7 +204,7 @@ // newly created tag, check if existing // create a new tag tag = this.collection.create({ - name: e.object.name, + name: e.object.name.trim(), userVisible: true, userAssignable: true }, { @@ -219,7 +219,7 @@ self.collection.fetch({ success: function(collection) { // find the tag in the collection - var model = collection.where({name: e.object.name, userVisible: true, userAssignable: true}); + var model = collection.where({name: e.object.name.trim(), userVisible: true, userAssignable: true}); if (model.length) { model = model[0]; // the tag already exists or was already assigned, @@ -260,7 +260,7 @@ var self = this; this.collection.fetch({ success: function(collection) { - var tagModels = collection.filterByName(query.term); + var tagModels = collection.filterByName(query.term.trim()); if (!self._isAdmin) { tagModels = _.filter(tagModels, function(tagModel) { return tagModel.get('userAssignable'); @@ -319,6 +319,7 @@ * @return {Object} dummy tag */ _createSearchChoice: function(term) { + term = term.trim(); if (this.collection.filterByName(term).length) { return; } |