From 405d53220bca1c4401a46c5212a9bdee9efb0673 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Thu, 14 Jan 2021 00:24:22 +0000 Subject: [PATCH] Fix server stability issue --- lib/tools/redownload/redownload.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/tools/redownload/redownload.js b/lib/tools/redownload/redownload.js index 484d807..c9cab77 100644 --- a/lib/tools/redownload/redownload.js +++ b/lib/tools/redownload/redownload.js @@ -758,11 +758,13 @@ var Redownload = function() { return request.isHTML && request.weightCheck && request.weightCheck.bodyBuffer; }); + if (!htmlRequest) { + return false; + } + debug('Checking if it is WordPress on file %s', htmlRequest.url); - if (htmlRequest && - (htmlRequest.weightCheck.bodyBuffer.indexOf('/wp-content/') >= 0 || - htmlRequest.weightCheck.bodyBuffer.indexOf('/wp-includes/') >= 0)) { + if (htmlRequest.weightCheck.bodyBuffer.indexOf('/wp-content/') >= 0 || htmlRequest.weightCheck.bodyBuffer.indexOf('/wp-includes/') >= 0) { debug('Response: yes.'); return true; } else {