LibWeb: Implement and use "isomorphic decoding"

This commit is contained in:
Gingeh 2024-10-21 14:45:35 +11:00 committed by Tim Flynn
commit ebb8342cf2
Notes: github-actions[bot] 2024-10-29 12:27:12 +00:00
6 changed files with 40 additions and 13 deletions

View file

@ -9,6 +9,7 @@
#include <AK/Base64.h>
#include <LibURL/URL.h>
#include <LibWeb/Fetch/Infrastructure/URL.h>
#include <LibWeb/Infra/Strings.h>
#include <LibWeb/MimeSniff/MimeType.h>
namespace Web::Fetch::Infrastructure {
@ -75,7 +76,7 @@ ErrorOr<DataURL> process_data_url(URL::URL const& data_url)
trimmed_substring_view = trimmed_substring_view.trim(" "sv, TrimMode::Right);
if (trimmed_substring_view.ends_with(';')) {
// 1. Let stringBody be the isomorphic decode of body.
auto string_body = StringView(body);
auto string_body = Infra::isomorphic_decode(body);
// 2. Set body to the forgiving-base64 decode of stringBody.
// 3. If body is failure, then return failure.