From 4aaf8df8657b21cfd5e1744a54b2e8b071906b6c Mon Sep 17 00:00:00 2001 From: Maciej Zygmanowski Date: Wed, 19 May 2021 13:34:04 +0200 Subject: [PATCH] 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) :) --- Userland/Applications/Browser/Tab.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Userland/Applications/Browser/Tab.cpp b/Userland/Applications/Browser/Tab.cpp index 55492e8c6c9..2af6c42ed65 100644 --- a/Userland/Applications/Browser/Tab.cpp +++ b/Userland/Applications/Browser/Tab.cpp @@ -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);