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.
This commit is contained in:
Adrien Destugues 2016-11-03 14:34:33 +01:00
parent b7bc818b0e
commit fe8f306c49

View File

@ -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);
}