Browse Source

Fix requests offenders

Gaël Métais 10 years ago
parent
commit
8d4a0c34e7
3 changed files with 3 additions and 4 deletions
  1. 1 2
      front/src/views/rule.html
  2. 1 1
      lib/metadata/policies.js
  3. 1 1
      lib/offendersHelpers.js

+ 1 - 2
front/src/views/rule.html

@@ -137,9 +137,8 @@
                         <file-and-line-button file="offender.file" line="offender.line" column="offender.column"></file-and-line-button>
                     </div>
 
-                    <div ng-if="policyName === 'requests' || policyName === 'smallJsFiles' || policyName === 'smallCssFiles' || policyName === 'smallImages'">
+                    <div ng-if="policyName === 'requests'">
                         <url-link url="offender.file" max-length="100"></url-link>
-                        <span ng-if="offender.size || offender.size === 0">({{offender.size}} KB)</span>
                     </div>
 
                     <div ng-if="policyName === 'notFound' || policyName === 'closedConnections' || policyName === 'multipleRequests' || policyName === 'cachingDisabled' || policyName === 'cachingNotSpecified'">

+ 1 - 1
lib/metadata/policies.js

@@ -900,7 +900,7 @@ var policies = {
         "isBadThreshold": 100,
         "isAbnormalThreshold": 200,
         "hasOffenders": true,
-        "takeOffendersFrom": ["htmlCount", "jsCount", "cssCount", "imageCount", "webfontCount", "videoCount", "jsonCount", "jsonCount"],
+        "takeOffendersFrom": ["htmlCount", "jsCount", "cssCount", "imageCount", "webfontCount", "videoCount", "jsonCount", "otherCount"],
         "offendersTransformFn": function(offenders) {
             return {
                 count: offenders.length,

+ 1 - 1
lib/offendersHelpers.js

@@ -168,7 +168,7 @@ var OffendersHelpers = function() {
     };
 
     this.fileWithSizePattern = function(fileWithSize) {
-        var parts = /^([^ ]*) \((\d+\.\d{2}) kB\)$/.exec(fileWithSize);
+        var parts = /^([^ ]*) \((\d+\.\d{2}|NaN) kB\)$/.exec(fileWithSize);
 
         if (!parts) {
             return {