diff options
Diffstat (limited to 'cli/js/web/blob.ts')
-rw-r--r-- | cli/js/web/blob.ts | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/cli/js/web/blob.ts b/cli/js/web/blob.ts index 5309ddaf4..c4e4674ab 100644 --- a/cli/js/web/blob.ts +++ b/cli/js/web/blob.ts @@ -139,24 +139,23 @@ export class DenoBlob implements domTypes.Blob { } const { ending = "transparent", type = "" } = options ?? {}; - if (!containsOnlyASCII(type)) { - const errMsg = "The 'type' property must consist of ASCII characters."; - throw new SyntaxError(errMsg); - } - - const bytes = processBlobParts(blobParts!, { ending, type }); // Normalize options.type. let normalizedType = type; - if (type.length) { - for (let i = 0; i < type.length; ++i) { - const char = type[i]; - if (char < "\u0020" || char > "\u007E") { - normalizedType = ""; - break; + if (!containsOnlyASCII(type)) { + normalizedType = ""; + } else { + if (type.length) { + for (let i = 0; i < type.length; ++i) { + const char = type[i]; + if (char < "\u0020" || char > "\u007E") { + normalizedType = ""; + break; + } } + normalizedType = type.toLowerCase(); } - normalizedType = type.toLowerCase(); } + const bytes = processBlobParts(blobParts!, { ending, type }); // Set Blob object's properties. this[bytesSymbol] = bytes; this.size = bytes.byteLength; |