1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 22:05:06 +00:00

Everywhere: Fix incorrect uses of String::format and StringBuilder::appendf

These changes are arbitrarily divided into multiple commits to make it
easier to find potentially introduced bugs with git bisect.
This commit is contained in:
Sahan Fernando 2021-01-12 01:01:33 +11:00 committed by Andreas Kling
parent 6d97b623cd
commit fe2b8906d4
7 changed files with 21 additions and 21 deletions

View file

@ -219,6 +219,9 @@ void FrameLoader::load_html(const StringView& html, const URL& url)
frame().set_document(&parser.document());
}
// FIXME: Use an actual templating engine (our own one when it's built, preferably
// with a way to check these usages at compile time)
void FrameLoader::load_error_page(const URL& failed_url, const String& error)
{
auto error_page_url = "file:///res/html/error.html";
@ -226,10 +229,12 @@ void FrameLoader::load_error_page(const URL& failed_url, const String& error)
error_page_url,
[this, failed_url, error](auto data, auto&) {
ASSERT(!data.is_null());
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
auto html = String::format(
String::copy(data).characters(),
escape_html_entities(failed_url.to_string()).characters(),
escape_html_entities(error).characters());
#pragma GCC diagnostic pop
auto document = HTML::parse_html_document(html, failed_url, "utf-8");
ASSERT(document);
frame().set_document(document);