fix: invalid input syntax for type bigint "NaN"
This commit is contained in:
parent
20642075f8
commit
8ce4865d04
@ -8,7 +8,7 @@ const defaultAvatar = (): string => {
|
||||
};
|
||||
|
||||
function isNumeric(str: string) {
|
||||
return !Number.isNaN(str) && !Number.isNaN(Number.parseFloat(str));
|
||||
return /^-?\d+$/.test(str);
|
||||
}
|
||||
|
||||
const avatarImage = async (
|
||||
@ -42,7 +42,7 @@ export const GET: APIRoute = async ({ params, redirect }) => {
|
||||
|
||||
// This is a existed user.
|
||||
if (isNumeric(hash)) {
|
||||
const email = await queryEmail(Number(hash));
|
||||
const email = await queryEmail(Number.parseInt(hash));
|
||||
if (email === null) {
|
||||
return redirect(defaultAvatar());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user