summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-12-06 13:29:03 +0100
committerRémy Coutable <remy@rymai.me>2016-12-06 13:29:35 +0100
commit8a06246ae3d35e2a186e59b19d04cfaf42f1ba2b (patch)
tree3f454b91c862fe6e32e461dbf19dd010418e5197
parentdc5af2ec202a96c45af61e7e38fafebd569f0c36 (diff)
downloadgitlab-ce-24961-fix-label-autocomplete-not-wrapping-in-quotes.tar.gz
Fix the label quote-wrapping in GfmAutoComplete24961-fix-label-autocomplete-not-wrapping-in-quotes
Signed-off-by: Rémy Coutable <remy@rymai.me>
-rw-r--r--app/assets/javascripts/gfm_auto_complete.js.es66
-rw-r--r--changelogs/unreleased/24961-fix-label-autocomplete-not-wrapping-in-quotes.yml4
2 files changed, 7 insertions, 3 deletions
diff --git a/app/assets/javascripts/gfm_auto_complete.js.es6 b/app/assets/javascripts/gfm_auto_complete.js.es6
index 6f9d6283071..b01fd596f1e 100644
--- a/app/assets/javascripts/gfm_auto_complete.js.es6
+++ b/app/assets/javascripts/gfm_auto_complete.js.es6
@@ -287,10 +287,10 @@
beforeSave: function(merges) {
var sanitizeLabelTitle;
sanitizeLabelTitle = function(title) {
- if (/[\w\?&]+\s+[\w\?&]+/g.test(title)) {
- return "\"" + (sanitize(title)) + "\"";
- } else {
+ if (/^[A-Za-z0-9_\-\?\.&]+$/.test(title)) {
return sanitize(title);
+ } else {
+ return "\"" + (sanitize(title)) + "\"";
}
};
return $.map(merges, function(m) {
diff --git a/changelogs/unreleased/24961-fix-label-autocomplete-not-wrapping-in-quotes.yml b/changelogs/unreleased/24961-fix-label-autocomplete-not-wrapping-in-quotes.yml
new file mode 100644
index 00000000000..3fb3e6d46ae
--- /dev/null
+++ b/changelogs/unreleased/24961-fix-label-autocomplete-not-wrapping-in-quotes.yml
@@ -0,0 +1,4 @@
+---
+title: Fix the label quote-wrapping in GfmAutoComplete
+merge_request:
+author: