Skip to content

Commit

Permalink
fix: app crash on qutebrowser
Browse files Browse the repository at this point in the history
add a prop in numberformat options that was resulting in out of range error.
also swapped
'replaceAll' with 'replace'

#24
  • Loading branch information
zyachel committed Dec 10, 2022
1 parent c2df20e commit 78b14ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
5 changes: 1 addition & 4 deletions src/components/title/Info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
7 changes: 4 additions & 3 deletions src/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 78b14ec

Please sign in to comment.