Skip to content

Commit

Permalink
url: fix handling of ? in URLSearchParams creation
Browse files Browse the repository at this point in the history
  • Loading branch information
TimothyGu committed Feb 14, 2017
1 parent 781eb90 commit 2b95bf3
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/internal/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,11 @@ function onParseComplete(flags, protocol, username, password,
ctx.query = query;
ctx.fragment = fragment;
ctx.host = host;
if (this[searchParams]) { // invoked from href setter
initSearchParams(this[searchParams], query);
} else {
this[searchParams] = new URLSearchParams(query);
if (!this[searchParams]) { // invoked from URL constructor
this[searchParams] = new URLSearchParams();
this[searchParams][context] = this;
}
this[searchParams][context] = this;
initSearchParams(this[searchParams], query);
}

// Reused by URL constructor and URL#href setter.
Expand Down

0 comments on commit 2b95bf3

Please sign in to comment.