mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
fix(route): improved ogImageUrl validation
- Update schema from z.url().max() to use .pipe() with length check. - Properly validates URL format while preventing oversized input.
This commit is contained in:
parent
0471c6b452
commit
fc78c4a5ff
2 changed files with 2 additions and 2 deletions
|
|
@ -29,7 +29,7 @@ export async function POST(request: Request, { params }: { params: Promise<{ lin
|
||||||
slug: z.string().min(4).optional(),
|
slug: z.string().min(4).optional(),
|
||||||
ogTitle: z.string().max(500).optional(),
|
ogTitle: z.string().max(500).optional(),
|
||||||
ogDescription: z.string().max(500).optional(),
|
ogDescription: z.string().max(500).optional(),
|
||||||
ogImageUrl: z.url().max(500).optional().or(z.literal('')),
|
ogImageUrl: z.union([z.string().max(500).pipe(z.url()), z.literal('')]).optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
const { auth, body, error } = await parseRequest(request, schema);
|
const { auth, body, error } = await parseRequest(request, schema);
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ export async function POST(request: Request) {
|
||||||
slug: z.string().min(4).max(100),
|
slug: z.string().min(4).max(100),
|
||||||
ogTitle: z.string().max(500).optional(),
|
ogTitle: z.string().max(500).optional(),
|
||||||
ogDescription: z.string().max(500).optional(),
|
ogDescription: z.string().max(500).optional(),
|
||||||
ogImageUrl: z.url().max(500).optional().or(z.literal('')),
|
ogImageUrl: z.union([z.string().max(500).pipe(z.url()), z.literal('')]).optional(),
|
||||||
teamId: z.string().nullable().optional(),
|
teamId: z.string().nullable().optional(),
|
||||||
id: z.uuid().nullable().optional(),
|
id: z.uuid().nullable().optional(),
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue