From 654f72aabc85c726675f7f2af132fd6dfdc1cdd7 Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Thu, 23 Feb 2023 22:31:34 +0530 Subject: [PATCH] fix: strengthen isStream condition checking --- lib/core/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/core/util.js b/lib/core/util.js index 334bc26c776..c6237c09404 100644 --- a/lib/core/util.js +++ b/lib/core/util.js @@ -15,7 +15,7 @@ const [nodeMajor, nodeMinor] = process.versions.node.split('.').map(v => Number( function nop () {} function isStream (obj) { - return obj && typeof obj.pipe === 'function' + return obj && typeof obj === 'object' && typeof obj.pipe === 'function' && typeof obj.on === 'function' } // based on https://github.com/node-fetch/fetch-blob/blob/8ab587d34080de94140b54f07168451e7d0b655e/index.js#L229-L241 (MIT License)