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
This commit is contained in:
zyachel 2022-12-10 20:13:34 +05:30
parent c2df20e6ad
commit 78b14ec079
2 changed files with 5 additions and 7 deletions

View file

@ -124,10 +124,7 @@ const Info = ({ info, className, router }: Props) => {
{keywords.list.map(word => (
<li className={styles.keywords__item} key={word}>
<Link
href={`/search/keyword/?keywords=${word.replaceAll(
' ',
'-'
)}`}
href={`/search/keyword/?keywords=${word.replace(/\s/g,'-')}`}
>
<a className='link'>{word}</a>
</Link>

View file

@ -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) {