summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Knox <psimyn@gmail.com>2018-01-16 22:22:45 +1100
committerSimon Knox <psimyn@gmail.com>2018-01-16 22:22:45 +1100
commitaaa239686cb1504c3b992fbcec7f27f2c20ec5dd (patch)
tree92a7c57e99fde3a6d6eaac1b0eca6f196db0a41d
parent5abdcf1be9fec29d14c1d5e7a9cc0aef2edaeff9 (diff)
downloadgitlab-ce-aaa239686cb1504c3b992fbcec7f27f2c20ec5dd.tar.gz
fix board filter parsing - don't replace encoded + symbols with spaces
-rw-r--r--app/assets/javascripts/boards/utils/query_data.js2
-rw-r--r--changelogs/unreleased/34252-trailing-plus.yml5
-rw-r--r--spec/javascripts/boards/utils/query_data_spec.js21
3 files changed, 27 insertions, 1 deletions
diff --git a/app/assets/javascripts/boards/utils/query_data.js b/app/assets/javascripts/boards/utils/query_data.js
index 2cd3c146f11..65315979df7 100644
--- a/app/assets/javascripts/boards/utils/query_data.js
+++ b/app/assets/javascripts/boards/utils/query_data.js
@@ -5,7 +5,7 @@ export default (path, extraData) => path.split('&').reduce((dataParam, filterPar
const paramSplit = filterParam.split('=');
const paramKeyNormalized = paramSplit[0].replace('[]', '');
const isArray = paramSplit[0].indexOf('[]');
- const value = decodeURIComponent(paramSplit[1]).replace(/\+/g, ' ');
+ const value = decodeURIComponent(paramSplit[1].replace(/\+/g, ' '));
if (isArray !== -1) {
if (!data[paramKeyNormalized]) {
diff --git a/changelogs/unreleased/34252-trailing-plus.yml b/changelogs/unreleased/34252-trailing-plus.yml
new file mode 100644
index 00000000000..66ad1d29eed
--- /dev/null
+++ b/changelogs/unreleased/34252-trailing-plus.yml
@@ -0,0 +1,5 @@
+---
+title: allow trailing + on labels in board filters
+merge_request:
+author:
+type: fixed
diff --git a/spec/javascripts/boards/utils/query_data_spec.js b/spec/javascripts/boards/utils/query_data_spec.js
new file mode 100644
index 00000000000..a8866ac6af4
--- /dev/null
+++ b/spec/javascripts/boards/utils/query_data_spec.js
@@ -0,0 +1,21 @@
+import queryData from '~/boards/utils/query_data';
+
+describe('queryData', () => {
+ it('parses path for label with trailing +', () => {
+ const path = 'label_name[]=label%2B';
+ expect(
+ queryData(path, {}),
+ ).toEqual({
+ label_name: ['label+'],
+ });
+ });
+
+ it('parses path for milestone with trailing +', () => {
+ const path = 'milestone_title=A%2B';
+ expect(
+ queryData(path, {}),
+ ).toEqual({
+ milestone_title: 'A+',
+ });
+ });
+});