summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShannon Booth <shannon.ml.booth@gmail.com>2023-06-05 10:57:28 +1200
committerAndreas Kling <kling@serenityos.org>2023-06-05 06:55:18 +0200
commit7f6a49c08560863a99ff80f84ba346a652f792d5 (patch)
tree5880ca17b0e24164678e6551718ba5eb6da4fbc0
parenta9e37be7a0c51091d9a4b072a771f9790a53fc2e (diff)
downloadserenity-7f6a49c08560863a99ff80f84ba346a652f792d5.zip
LibWeb: Ensure that contentType in Blob::slice is basic latin
-rw-r--r--Userland/Libraries/LibWeb/FileAPI/Blob.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/Userland/Libraries/LibWeb/FileAPI/Blob.cpp b/Userland/Libraries/LibWeb/FileAPI/Blob.cpp
index b45da63bd3..f380258451 100644
--- a/Userland/Libraries/LibWeb/FileAPI/Blob.cpp
+++ b/Userland/Libraries/LibWeb/FileAPI/Blob.cpp
@@ -230,10 +230,12 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Blob>> Blob::slice(Optional<i64> start, Opt
} else {
// b. Else let relativeContentType be set to contentType and run the substeps below:
- // FIXME: 1. If relativeContentType contains any characters outside the range of U+0020 to U+007E, then set relativeContentType to the empty string and return from these substeps.
-
- // 2. Convert every character in relativeContentType to ASCII lowercase.
- relative_content_type = TRY_OR_THROW_OOM(vm, Infra::to_ascii_lowercase(content_type.value()));
+ // 1. If relativeContentType contains any characters outside the range of U+0020 to U+007E, then set relativeContentType to the empty string and return from these substeps.
+ // NOTE: contentType is set to empty string at declaration.
+ if (is_basic_latin(content_type.value())) {
+ // 2. Convert every character in relativeContentType to ASCII lowercase.
+ relative_content_type = TRY_OR_THROW_OOM(vm, Infra::to_ascii_lowercase(content_type.value()));
+ }
}
// 4. Let span be max((relativeEnd - relativeStart), 0).