Explorar o código

Fix regex in `getOptimalLogoHeightKey` to correctly
parse height numbers

Signed-off-by: Mihaela Balutoiu <mbalutoiu@cloudbasesolutions.com>

Mihaela Balutoiu hai 3 meses
pai
achega
06707f4676
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      server/api/LogosApi.ts

+ 2 - 2
server/api/LogosApi.ts

@@ -41,8 +41,8 @@ const getOptimalLogoHeightKey = (
   }
   }
 
 
   const optimal = heightKeys.reduce((prev, curr) => {
   const optimal = heightKeys.reduce((prev, curr) => {
-    let prevHeight: any = /d+/.exec(prev);
-    let currHeight: any = /d+/.exec(curr);
+    let prevHeight: any = /\d+/.exec(prev);
+    let currHeight: any = /\d+/.exec(curr);
     prevHeight = prevHeight ? Number(prevHeight[0]) : 0;
     prevHeight = prevHeight ? Number(prevHeight[0]) : 0;
     currHeight = currHeight ? Number(currHeight[0]) : 0;
     currHeight = currHeight ? Number(currHeight[0]) : 0;
     return Math.abs(currHeight - requestedHeight) <
     return Math.abs(currHeight - requestedHeight) <