mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2026-04-19 02:10:26 +00:00
LibWeb: Chain all accept attribute checks in parse_accept_attribute()
The wildcard checks for audio/* and video/* are standalone if
statements, while the MIME-type and extension branches are
else-if chained only to the image/* check. When a token like
"audio/*" arrives, it matches the first if (adding
FileType::Audio) and then falls through to the MIME-type
else-if. MimeType::parse() accepts the wildcard because * is a
valid HTTP token code point, so a second MimeType{"audio/*"}
entry is added. FileFilter::add_filter() deduplicates within
variant types but cannot catch this cross-type duplication.
This chains all five conditions into a single if/else-if,
matching the spec's mutually exclusive "one of the following"
wording.
This commit is contained in:
parent
56287ca90f
commit
36d8191a3d
Notes:
github-actions[bot]
2026-02-13 20:34:07 +00:00
Author: https://github.com/Praise-Garfield
Commit: 36d8191a3d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7933
1 changed files with 2 additions and 2 deletions
|
|
@ -333,12 +333,12 @@ FileFilter HTMLInputElement::parse_accept_attribute() const
|
|||
|
||||
// The string "video/*"
|
||||
// Indicates that video files are accepted.
|
||||
if (value.equals_ignoring_ascii_case("video/*"sv))
|
||||
else if (value.equals_ignoring_ascii_case("video/*"sv))
|
||||
filter.add_filter(FileFilter::FileType::Video);
|
||||
|
||||
// The string "image/*"
|
||||
// Indicates that image files are accepted.
|
||||
if (value.equals_ignoring_ascii_case("image/*"sv))
|
||||
else if (value.equals_ignoring_ascii_case("image/*"sv))
|
||||
filter.add_filter(FileFilter::FileType::Image);
|
||||
|
||||
// A valid MIME type string with no parameters
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue