summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-05-12 09:27:21 +0100
committerPhil Hughes <me@iamphill.com>2017-05-12 09:27:21 +0100
commit477be05661d2cd3a550510f898d8d1d222d1598f (patch)
treef430ed67c08b1e06041fc0f6f37a51daaa6660fd
parent2ac27a96b86738bd272e434d7f82c5faf8bb578c (diff)
downloadgitlab-ce-477be05661d2cd3a550510f898d8d1d222d1598f.tar.gz
Fixed issue boards not filtering when URL params are encoded
Closes #32084
-rw-r--r--app/assets/javascripts/lib/utils/common_utils.js2
-rw-r--r--spec/javascripts/lib/utils/common_utils_spec.js10
2 files changed, 11 insertions, 1 deletions
diff --git a/app/assets/javascripts/lib/utils/common_utils.js b/app/assets/javascripts/lib/utils/common_utils.js
index 2f682fbd2fb..2eab6f975bb 100644
--- a/app/assets/javascripts/lib/utils/common_utils.js
+++ b/app/assets/javascripts/lib/utils/common_utils.js
@@ -135,7 +135,7 @@
gl.utils.getUrlParamsArray = function () {
// We can trust that each param has one & since values containing & will be encoded
// Remove the first character of search as it is always ?
- return window.location.search.slice(1).split('&');
+ return window.location.search.slice(1).split('&').map(param => decodeURI(param));
};
gl.utils.isMetaKey = function(e) {
diff --git a/spec/javascripts/lib/utils/common_utils_spec.js b/spec/javascripts/lib/utils/common_utils_spec.js
index 5eb147ed888..42a9067ade5 100644
--- a/spec/javascripts/lib/utils/common_utils_spec.js
+++ b/spec/javascripts/lib/utils/common_utils_spec.js
@@ -41,6 +41,16 @@ require('~/lib/utils/common_utils');
const paramsArray = gl.utils.getUrlParamsArray();
expect(paramsArray[0][0] !== '?').toBe(true);
});
+
+ it('should decode params', () => {
+ history.pushState('', '', '?label_name%5B%5D=test');
+
+ expect(
+ gl.utils.getUrlParamsArray()[0],
+ ).toBe('label_name[]=test');
+
+ history.pushState('', '', '?');
+ });
});
describe('gl.utils.handleLocationHash', () => {