ソースを参照

Fix regex in `getOptimalLogoHeightKey` to correctly
parse height numbers

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

Mihaela Balutoiu 5 ヶ月 前
コミット
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) <