1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 11:58:13 +00:00

LibWeb: Use URL::to_string_encoded() for the crash error page URL's href

Just wrapping to_string() in urlencode() will break the link as too many
characters are encoded. Also wrap in escape_html_entities() as well -
most relevant chars are already URL-encoded, but this will change '&' to
'&', for example.
This commit is contained in:
Linus Groh 2021-01-31 18:44:40 +01:00 committed by Andreas Kling
parent e0066ff2d7
commit 521a38d9c5

View file

@ -69,7 +69,7 @@ void OutOfProcessWebView::create_client()
builder.appendff(" on {}", escape_html_entities(m_url.host()));
}
builder.append("</h1>");
builder.appendff("The web page <a href='{}'>{}</a> has crashed.<br><br>You can reload the page to try again.", AK::urlencode(m_url.to_string()), escape_html_entities(m_url.to_string()));
builder.appendff("The web page <a href=\"{}\">{}</a> has crashed.<br><br>You can reload the page to try again.", escape_html_entities(m_url.to_string_encoded()), escape_html_entities(m_url.to_string()));
builder.append("</body></html>");
load_html(builder.to_string(), m_url);
};