From 6a1abd2c037f04436462c03d4e1768ab5511a029 Mon Sep 17 00:00:00 2001 From: Gaurish Sethia Date: Mon, 25 Dec 2023 09:59:00 +0530 Subject: [PATCH] util: pass invalidSubtypeIndex instead of trimmedSubtype to error PR-URL: https://github.com/nodejs/node/pull/51264 Reviewed-By: Luigi Pinca Reviewed-By: Deokjin Kim --- lib/internal/mime.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/mime.js b/lib/internal/mime.js index 0a1d8e7e679..07d80a72625 100644 --- a/lib/internal/mime.js +++ b/lib/internal/mime.js @@ -70,7 +70,7 @@ function parseTypeAndSubtype(str) { const invalidSubtypeIndex = SafeStringPrototypeSearch(trimmedSubtype, NOT_HTTP_TOKEN_CODE_POINT); if (trimmedSubtype === '' || invalidSubtypeIndex !== -1) { - throw new ERR_INVALID_MIME_SYNTAX('subtype', str, trimmedSubtype); + throw new ERR_INVALID_MIME_SYNTAX('subtype', str, invalidSubtypeIndex); } const subtype = toASCIILower(trimmedSubtype); return [