dub
dub copied to clipboard
Quick Fix : Enforce Integer Validation for 'page' Parameter in Pagination
Problem:
The current API endpoint https://api.dub.co/links accepts fractional and negative numbers for the page query parameter, causing unexpected errors.
"error": {
"code": "internal_server_error",
"message": "An internal server error occurred. Please contact our support if the problem persists.",
"doc_url": "https://dub.co/docs/api-reference/errors#internal_server_error"
}
Solution:
This pull request updates the Zod validation schema for the page parameter. The modifications ensure that only non-negative integers are acceptable. This is achieved by adding .int() and .nonnegative() checks to the schema.
page: z.coerce
.number()
.int()
.nonnegative()
.optional()
.describe(
"The page number for pagination (each page contains 100 links).",
),
@aliamerj is attempting to deploy a commit to the Dub Team on Vercel.
A member of the Team first needs to authorize it.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| dub | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | May 8, 2024 1:37pm |
Great catch, thank you!