Skip to content

Commit 8bf3b91

Browse files
committed
Fix for multiple equal (=) signs in query param value.
1 parent 71f054c commit 8bf3b91

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

tests.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ test('query string', function() {
112112

113113
deepEqual( window.url( '?poo', 'http://domain.com?poo=a+b' ), 'a b' );
114114
deepEqual( window.url( '?poo', 'http://domain.com?poo=javascript%20decode%20uri%20%2B%20sign%20to%20space' ), 'javascript decode uri + sign to space' );
115+
116+
deepEqual( window.url( '?key', 'http://domain.com?key=value=va?key2=value' ), 'value=va');
115117
});
116118

117119
test('url fragment', function() {

url.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ window.url = (function() {
6767

6868
for(var i=0,ii=params.length; i<ii; i++)
6969
{
70-
param = params[i].split('=');
70+
param = params[i].split(/(.*?)=(.*)/).filter(Boolean);
71+
7172
if(param[0] === arg) { return (param[1] ? decode(param[1]) : param[1]) || ''; }
7273
}
7374

url.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)