diff options
author | Paul Slaughter <pslaughter@gitlab.com> | 2019-08-19 17:00:10 +0300 |
---|---|---|
committer | Paul Slaughter <pslaughter@gitlab.com> | 2019-08-19 18:28:23 +0300 |
commit | 4fdc34c10950863ad04a68dc2117371c95db7478 (patch) | |
tree | b7355bf68cbc240be181f309840e788bbabb9cea /spec | |
parent | b1905a396f7e7da89280aea4436eb7261d1cd34c (diff) |
Fix mergeUrlParams handling of `+`
**What was the issue?**
If a param value had `+`, it would be encoded as a
literal `+` instead of a space.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/frontend/lib/utils/url_utility_spec.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/frontend/lib/utils/url_utility_spec.js b/spec/frontend/lib/utils/url_utility_spec.js index a986bc49f28..b0bdd924921 100644 --- a/spec/frontend/lib/utils/url_utility_spec.js +++ b/spec/frontend/lib/utils/url_utility_spec.js @@ -94,6 +94,12 @@ describe('URL utility', () => { it('adds and updates encoded params', () => { expect(urlUtils.mergeUrlParams({ a: '&', q: '?' }, '?a=%23#frag')).toBe('?a=%26&q=%3F#frag'); }); + + it('treats "+" as "%20"', () => { + expect(urlUtils.mergeUrlParams({ ref: 'bogus' }, '?a=lorem+ipsum&ref=charlie')).toBe( + '?a=lorem%20ipsum&ref=bogus', + ); + }); }); describe('removeParams', () => { |