From 9e365a6c1cfa4800cf67e555251ca67bee18931c Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 26 Apr 2020 22:59:12 +0200 Subject: [PATCH] AK: Make URL::to_string() produce a data URL for data URLs :^) --- AK/URL.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/AK/URL.cpp b/AK/URL.cpp index 7e690ff68b..bf8b70045d 100644 --- a/AK/URL.cpp +++ b/AK/URL.cpp @@ -241,6 +241,17 @@ String URL::to_string() const { StringBuilder builder; builder.append(m_protocol); + + if (m_protocol == "data") { + builder.append(':'); + builder.append(m_data_mime_type); + if (m_data_payload_is_base64) + builder.append(";base64"); + builder.append(','); + builder.append(m_data_payload); + return builder.to_string(); + } + builder.append("://"); if (protocol() != "file") { builder.append(m_host);