feat(projects): add validation for name and description in PATCH request to ensure they are non-empty strings within specified length limits

This commit is contained in:
Yusuf İpek
2026-04-10 21:52:46 +03:00
parent db1c594fae
commit 05a303cd35
3 changed files with 43 additions and 0 deletions
@@ -94,6 +94,15 @@ export async function POST(request: NextRequest, { params }: RouteParams) {
return apiErrors.badRequest('Video URL is required');
}
if (versionLabel !== undefined && versionLabel !== null) {
if (typeof versionLabel !== 'string') {
return apiErrors.badRequest('Version label must be a string');
}
if (versionLabel.trim().length > 100) {
return apiErrors.badRequest('Version label must be 100 characters or fewer');
}
}
// Validate URLs use safe schemes (http/https only)
const videoUrlError = validateUrl(videoUrl, 'Video URL');
if (videoUrlError) {