Skip to content
This repository has been archived by the owner on Apr 3, 2022. It is now read-only.

Commit

Permalink
Fix missing enteredUrl in getSearchInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
spikespaz committed Jul 6, 2020
1 parent cfa9f81 commit 8f2d50f
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions source/common.d
Original file line number Diff line number Diff line change
Expand Up @@ -317,15 +317,18 @@ Tuple!(string, "searchTerm", string, "enteredUrl", string, "selectedUrl") getSea
if (queryParams is null || "url" !in queryParams)
return returnTuple;

queryParams = getQueryParams(queryParams["url"].decodeComponent());

if ("url" in queryParams && "q" in queryParams) {
returnTuple.searchTerm = queryParams["q"].decodeComponent();
returnTuple.selectedUrl = cast(string) Base64URL.decode(queryParams["url"]);
} else if ("url" in queryParams)
returnTuple.enteredUrl = queryParams["url"].decodeComponent();
else if ("q" in queryParams)
returnTuple.searchTerm = queryParams["q"].decodeComponent();
const string urlParam = queryParams["url"].decodeComponent();

if (urlParam.matchFirst(r"^https:\/\/.+\.bing.com")) {
queryParams = getQueryParams(urlParam);

if ("url" in queryParams && "q" in queryParams) {
returnTuple.searchTerm = queryParams["q"].decodeComponent();
returnTuple.selectedUrl = cast(string) Base64URL.decode(queryParams["url"]);
} else if ("q" in queryParams)
returnTuple.searchTerm = queryParams["q"].decodeComponent();
} else
returnTuple.enteredUrl = urlParam;

return returnTuple;
}
Expand Down

0 comments on commit 8f2d50f

Please sign in to comment.