Просмотр исходного кода

Fix regex in `getOptimalLogoHeightKey` to correctly
parse height numbers

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

Mihaela Balutoiu 3 месяцев назад
Родитель
Сommit
06707f4676
1 измененных файлов с 2 добавлено и 2 удалено
  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) => {
-    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;
     currHeight = currHeight ? Number(currHeight[0]) : 0;
     return Math.abs(currHeight - requestedHeight) <