From 683cfcc30689a9ff2818d2345b9c707579839b6f Mon Sep 17 00:00:00 2001 From: tummala lakshmi manasa sai Date: Sun, 3 Dec 2023 16:12:34 -0600 Subject: [PATCH 1/2] est --- test.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 test.txt diff --git a/test.txt b/test.txt new file mode 100644 index 00000000..c2a6ddb9 --- /dev/null +++ b/test.txt @@ -0,0 +1 @@ +bcaj From 1b4e146127d166ab9e6ee139d31aa4c5da86bc3f Mon Sep 17 00:00:00 2001 From: tummala lakshmi manasa sai Date: Sun, 3 Dec 2023 16:23:29 -0600 Subject: [PATCH 2/2] regex check both . and .* --- src/is-binary.js | 2 +- test.txt | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 test.txt diff --git a/src/is-binary.js b/src/is-binary.js index 264a307f..6164c9ca 100644 --- a/src/is-binary.js +++ b/src/is-binary.js @@ -21,7 +21,7 @@ function getContentType ({ headers }) { function isContentTypeBinary ({ headers, binaryContentTypes }) { if (!binaryContentTypes || !Array.isArray(binaryContentTypes)) return false - const binaryContentTypesRegexes = binaryContentTypes.map(binaryContentType => new RegExp(`^${binaryContentType.replace(/\*/g, '.*')}$`)) + const binaryContentTypesRegexes = binaryContentTypes.map(binaryContentType => new RegExp(`^${binaryContentType.replace(/\*|\.\*/g, '.*')}$`)) const contentType = getContentType({ headers }) if (!contentType) return false diff --git a/test.txt b/test.txt deleted file mode 100644 index c2a6ddb9..00000000 --- a/test.txt +++ /dev/null @@ -1 +0,0 @@ -bcaj