Browser: Do not use AK::Format for search engine formatting

It is too complex because it supports many options that are not
used by the search engine. It just makes format validation more
complicated.

Additionaly, now it's possible to have { } characters in search
engine URL (although they are not valid URL characters) :)
This commit is contained in:
Maciej Zygmanowski 2021-05-19 13:34:04 +02:00 committed by Linus Groh
parent 78bc6c09ba
commit 4aaf8df865
Notes: sideshowbarker 2024-07-18 17:46:09 +09:00

View file

@ -37,7 +37,9 @@ namespace Browser {
URL url_from_user_input(const String& input)
{
if (input.starts_with("?") && !g_search_engine.is_null()) {
return URL(String::formatted(g_search_engine, urlencode(input.substring(1))));
auto url = g_search_engine;
url.replace("{}", urlencode(input.substring(1)));
return URL(url);
}
auto url = URL(input);