mirror of
https://github.com/versia-pub/server.git
synced 2025-12-07 16:58:20 +01:00
Update ID validation to use UUIDv7 format
This commit is contained in:
parent
02c63c4c6f
commit
2c704bd57c
|
|
@ -23,8 +23,12 @@ export const meta = applyConfig({
|
||||||
*/
|
*/
|
||||||
export default apiRoute(async (req, matchedRoute, extraData) => {
|
export default apiRoute(async (req, matchedRoute, extraData) => {
|
||||||
const id = matchedRoute.params.id;
|
const id = matchedRoute.params.id;
|
||||||
// Check if ID is valid UUID
|
// Check if ID is valid UUIDv7
|
||||||
if (!id.match(/^[0-9a-fA-F]{36}$/)) {
|
if (
|
||||||
|
!id.match(
|
||||||
|
/^[0-9A-F]{8}-[0-9A-F]{4}-[7][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,
|
||||||
|
)
|
||||||
|
) {
|
||||||
return errorResponse("Invalid ID", 404);
|
return errorResponse("Invalid ID", 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue