mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 21:38:10 +00:00
LibWeb: Make sure Blob type is not outside range 0x0020-0x007E
This makes sure that type is set to an empty string if BlobPropertyBag::type is outside the range 0x0020 to 0x007E.
This commit is contained in:
parent
73aec263b1
commit
c8c5f05de5
1 changed files with 9 additions and 2 deletions
|
@ -132,10 +132,17 @@ DOM::ExceptionOr<NonnullRefPtr<Blob>> Blob::create(Optional<Vector<BlobPart>> co
|
||||||
String type = String::empty();
|
String type = String::empty();
|
||||||
// 3. If the type member of the options argument is not the empty string, run the following sub-steps:
|
// 3. If the type member of the options argument is not the empty string, run the following sub-steps:
|
||||||
if (options.has_value() && !options->type.is_empty()) {
|
if (options.has_value() && !options->type.is_empty()) {
|
||||||
// FIXME: 1. Let t be the type dictionary member. If t contains any characters outside the range U+0020 to U+007E, then set t to the empty string and return from these substeps.
|
// 1. If the type member is provided and is not the empty string, let t be set to the type dictionary member.
|
||||||
|
// If t contains any characters outside the range U+0020 to U+007E, then set t to the empty string and return from these substeps.
|
||||||
|
// NOTE: t is set to empty string at declaration.
|
||||||
|
if (!options->type.is_empty()) {
|
||||||
|
if (is_basic_latin(options->type))
|
||||||
|
type = options->type;
|
||||||
|
}
|
||||||
|
|
||||||
// 2. Convert every character in t to ASCII lowercase.
|
// 2. Convert every character in t to ASCII lowercase.
|
||||||
type = options->type.to_lowercase();
|
if (!type.is_empty())
|
||||||
|
type = options->type.to_lowercase();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. Return a Blob object referring to bytes as its associated byte sequence, with its size set to the length of bytes, and its type set to the value of t from the substeps above.
|
// 4. Return a Blob object referring to bytes as its associated byte sequence, with its size set to the length of bytes, and its type set to the value of t from the substeps above.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue