Преглед на файлове

Improve WordPress detection

Gaël Métais преди 4 години
родител
ревизия
23d7dea0bb
променени са 1 файла, в които са добавени 6 реда и са изтрити 8 реда
  1. 6 8
      lib/tools/redownload/redownload.js

+ 6 - 8
lib/tools/redownload/redownload.js

@@ -753,14 +753,12 @@ var Redownload = function() {
     }
 
     function detectWordPress(requests) {
-        // Check the first file only
-        if (requests[0].isHTML && 
-            requests[0].weightCheck.bodyBuffer &&
-            requests[0].weightCheck.bodyBuffer.indexOf('/wp-content/') > 0) {
-            
-            return true;
-        }
-        return false;
+        // Check the first HTML file only
+        var htmlRequest = requests.find(function(request) {
+            return request.isHTML && request.weightCheck.bodyBuffer;
+        });
+
+        return htmlRequest && htmlRequest.weightCheck.bodyBuffer.indexOf('/wp-content/');
     }