From fe8f306c499859d45006d3684b19ac133ece069f Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Thu, 3 Nov 2016 14:34:33 +0100 Subject: [PATCH] WebPositive: fix search with URL-encoded pattern. The search URL for goodsearch is: http://www.goodsearch.com/search-web?utf8=%E2%9C%93&button=&keywords=%s It contains % characters (not too unusual for URLs with url-encoding). We can't give it to SetToFormat safely. Use ReplaceAll instead, so that only the %s is replaced. --- src/apps/webpositive/BrowserWindow.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/apps/webpositive/BrowserWindow.cpp b/src/apps/webpositive/BrowserWindow.cpp index 175dfa82b1..f9d1271215 100644 --- a/src/apps/webpositive/BrowserWindow.cpp +++ b/src/apps/webpositive/BrowserWindow.cpp @@ -2406,7 +2406,8 @@ BrowserWindow::_NewTabURL(bool isNewWindow) const url = fStartPageURL; break; case OpenSearchPage: - url.SetToFormat(fSearchPageURL, ""); + url.SetTo(fSearchPageURL); + url.ReplaceAll("%s", ""); break; case CloneCurrentPage: if (CurrentWebView() != NULL) @@ -2454,8 +2455,8 @@ BrowserWindow::_VisitURL(const BString& url) void BrowserWindow::_VisitSearchEngine(const BString& search) { - BString engine = ""; - engine.SetToFormat(fSearchPageURL, _EncodeURIComponent(search).String()); + BString engine(fSearchPageURL); + engine.ReplaceAll("%s", _EncodeURIComponent(search).String()); _VisitURL(engine); }