mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 21:59:07 +00:00
LibWeb/DOM: Add missing UTF-8 decode without BOM on fragment ID
We were previously crashing instead of using the replacement character on invalid bytes.
This commit is contained in:
parent
67f435975b
commit
c954d0be27
Notes:
github-actions[bot]
2025-02-10 09:49:08 +00:00
Author: https://github.com/shannonbooth
Commit: c954d0be27
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3525
Reviewed-by: https://github.com/tcl3 ✅
7 changed files with 137 additions and 2 deletions
|
@ -2451,10 +2451,10 @@ Document::IndicatedPart Document::determine_the_indicated_part() const
|
|||
|
||||
// 5. Let fragmentBytes be the result of percent-decoding fragment.
|
||||
// 6. Let decodedFragment be the result of running UTF-8 decode without BOM on fragmentBytes.
|
||||
auto decoded_fragment = URL::percent_decode(*fragment);
|
||||
auto decoded_fragment = String::from_utf8_with_replacement_character(URL::percent_decode(*fragment), String::WithBOMHandling::No);
|
||||
|
||||
// 7. Set potentialIndicatedElement to the result of finding a potential indicated element given document and decodedFragment.
|
||||
potential_indicated_element = find_a_potential_indicated_element(MUST(FlyString::from_deprecated_fly_string(decoded_fragment)));
|
||||
potential_indicated_element = find_a_potential_indicated_element(decoded_fragment);
|
||||
|
||||
// 8. If potentialIndicatedElement is not null, then return potentialIndicatedElement.
|
||||
if (potential_indicated_element)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue