From 78b14ec07955d29403b8b5ae0d449f38eea2bbc5 Mon Sep 17 00:00:00 2001 From: zyachel Date: Sat, 10 Dec 2022 20:13:34 +0530 Subject: [PATCH] fix: app crash on qutebrowser add a prop in numberformat options that was resulting in out of range error. also swapped 'replaceAll' with 'replace' https://github.com/zyachel/libremdb/issues/24 --- src/components/title/Info.tsx | 5 +---- src/utils/helpers.ts | 7 ++++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/components/title/Info.tsx b/src/components/title/Info.tsx index daf3d3b..8ee9983 100644 --- a/src/components/title/Info.tsx +++ b/src/components/title/Info.tsx @@ -124,10 +124,7 @@ const Info = ({ info, className, router }: Props) => { {keywords.list.map(word => (
  • {word} diff --git a/src/utils/helpers.ts b/src/utils/helpers.ts index a4c1acd..8ffe821 100644 --- a/src/utils/helpers.ts +++ b/src/utils/helpers.ts @@ -46,16 +46,17 @@ export const formatMoney = (num: number, cur: string) => { style: 'currency', currency: cur, maximumFractionDigits: 0, + minimumFractionDigits: 0, }).format(num); }; export const modifyIMDbImg = (url: string, widthInPx = 600) => { - return url.replaceAll('.jpg', `UX${widthInPx}.jpg`); + return url.replace(/\.jpg/g, `UX${widthInPx}.jpg`); }; export const getProxiedIMDbImgUrl = (url: string) => { - return `/api/media_proxy?url=${encodeURIComponent(url)}`; -} + return `/api/media_proxy?url=${encodeURIComponent(url)}`; +}; export const AppError = class extends Error { constructor(message: string, public statusCode: number, cause?: any) {