diff --git a/Libraries/LibWeb/MimeSniff/Resource.cpp b/Libraries/LibWeb/MimeSniff/Resource.cpp index 16fa183b4c5..df69b79d376 100644 --- a/Libraries/LibWeb/MimeSniff/Resource.cpp +++ b/Libraries/LibWeb/MimeSniff/Resource.cpp @@ -498,8 +498,8 @@ Optional match_an_archive_type_pattern(ReadonlyBytes input) // The string "PK" followed by ETX EOT, the ZIP archive signature. BytePatternTableRow { "\x50\x4B\x03\x04"sv, "\xFF\xFF\xFF\xFF"sv, no_ignored_bytes, "application/zip"sv }, - // The string "Rar " followed by SUB BEL NUL, the RAR archive signature. - BytePatternTableRow { "\x52\x61\x72\x20\x1A\x07\x00"sv, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF"sv, no_ignored_bytes, "application/x-rar-compressed"sv }, + // The string "Rar!" followed by SUB BEL NUL, the RAR 4.x archive signature. + BytePatternTableRow { "\x52\x61\x72\x21\x1A\x07\x00"sv, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF"sv, no_ignored_bytes, "application/x-rar-compressed"sv }, }; for (auto const& row : pattern_table) { diff --git a/Tests/LibWeb/TestMimeSniff.cpp b/Tests/LibWeb/TestMimeSniff.cpp index bafb8cd637a..da5dedda0fc 100644 --- a/Tests/LibWeb/TestMimeSniff.cpp +++ b/Tests/LibWeb/TestMimeSniff.cpp @@ -159,7 +159,7 @@ TEST_CASE(determine_computed_mime_type_in_both_none_and_browsing_sniffing_contex mime_type_to_headers_map.set("application/x-gzip"sv, { "\x1F\x8B\x08"sv }); mime_type_to_headers_map.set("application/zip"sv, { "PK\x03\x04"sv }); - mime_type_to_headers_map.set("application/x-rar-compressed"sv, { "Rar\x20\x1A\x07\x00"sv }); + mime_type_to_headers_map.set("application/x-rar-compressed"sv, { "Rar!\x1A\x07\x00"sv }); for (auto const& mime_type_to_headers : mime_type_to_headers_map) { auto mime_type = mime_type_to_headers.key;