fix board filter parsing - don't replace encoded + symbols with spaces

This commit is contained in:
Simon Knox 2018-01-16 22:22:45 +11:00
parent 5abdcf1be9
commit aaa239686c
3 changed files with 27 additions and 1 deletions

View File

@ -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]) {

View File

@ -0,0 +1,5 @@
---
title: allow trailing + on labels in board filters
merge_request:
author:
type: fixed

View File

@ -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+',
});
});
});