From d8784a58e073f8e71c0fe722f81ce7d0dd83c58e Mon Sep 17 00:00:00 2001 From: Michal Tikotzky Date: Mon, 6 May 2019 15:48:50 -0400 Subject: [PATCH] Fix check for supported file types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The check for supported file types was added here - https://github.com/OptimalBits/bull/pull/1186. It’s checking for `supportedFileTypes.indexOf(path.extname(handler)) !== -1 ` but indexOf return a number `-1` not a string `’-`’`, so this check was always true. Updated to the number `-1`. --- lib/queue.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/queue.js b/lib/queue.js index 522107a5f..6af6e121c 100755 --- a/lib/queue.js +++ b/lib/queue.js @@ -629,7 +629,7 @@ Queue.prototype.setHandler = function(name, handler) { const supportedFileTypes = ['js', 'ts', 'flow']; const processorFile = handler + - (supportedFileTypes.indexOf(path.extname(handler)) !== '-1' ? '' : '.js'); + (supportedFileTypes.indexOf(path.extname(handler)) !== -1 ? '' : '.js'); if (!fs.existsSync(processorFile)) { throw new Error('File ' + processorFile + ' does not exist');