From 2fed27a23b797738305d95d30df942029fdf0b69 Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Thu, 23 Feb 2023 22:36:39 +0530 Subject: [PATCH] fix: strengthen isStream condition checking (#1969) --- 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 75e632118a7..e203919cc35 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)