fix: incorrect type check for number in request params
This commit is contained in:
parent
28772fcd9f
commit
9c0783c607
@ -17,4 +17,4 @@ export default {
|
|||||||
fetch,
|
fetch,
|
||||||
} satisfies Deno.ServeDefaultExport;
|
} satisfies Deno.ServeDefaultExport;
|
||||||
|
|
||||||
export const VERSION = "0.2.0";
|
export const VERSION = "0.2.1";
|
@ -15,9 +15,9 @@ const SnapshotQueryParamsSchema = object({
|
|||||||
const idSchema = mixed().test(
|
const idSchema = mixed().test(
|
||||||
"is-valid-id",
|
"is-valid-id",
|
||||||
'id must be a string starting with "av" followed by digits, or "BV" followed by 10 alphanumeric characters, or a positive integer',
|
'id must be a string starting with "av" followed by digits, or "BV" followed by 10 alphanumeric characters, or a positive integer',
|
||||||
(value) => {
|
async (value) => {
|
||||||
if (typeof value === "number") {
|
if (value && await number().isValid(value)) {
|
||||||
return Number.isInteger(value) && value > 0;
|
return Number.isInteger(value) && (value as number) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof value === "string") {
|
if (typeof value === "string") {
|
||||||
|
Loading…
Reference in New Issue
Block a user