Skip to content

Commit

Permalink
Fix for multiple equal (=) signs in query param value.
Browse files Browse the repository at this point in the history
  • Loading branch information
websanova committed Aug 21, 2015
1 parent 71f054c commit 8bf3b91
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ test('query string', function() {

deepEqual( window.url( '?poo', 'http://domain.com?poo=a+b' ), 'a b' );
deepEqual( window.url( '?poo', 'http://domain.com?poo=javascript%20decode%20uri%20%2B%20sign%20to%20space' ), 'javascript decode uri + sign to space' );

deepEqual( window.url( '?key', 'http://domain.com?key=value=va?key2=value' ), 'value=va');
});

test('url fragment', function() {
Expand Down
3 changes: 2 additions & 1 deletion url.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ window.url = (function() {

for(var i=0,ii=params.length; i<ii; i++)
{
param = params[i].split('=');
param = params[i].split(/(.*?)=(.*)/).filter(Boolean);

if(param[0] === arg) { return (param[1] ? decode(param[1]) : param[1]) || ''; }
}

Expand Down
2 changes: 1 addition & 1 deletion url.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8bf3b91

Please sign in to comment.