Don't fail for invalid userID

This commit is contained in:
Ajay Ramachandran
2021-07-19 16:13:14 -04:00
parent 04ed1112a4
commit db3701d76a

View File

@@ -342,9 +342,9 @@ export async function postSkipSegments(req: Request, res: Response): Promise<Res
if (typeof videoID !== 'string') {
invalidFields.push('videoID');
}
if (typeof userID !== 'string' || userID.length < 30) {
if (typeof userID !== 'string' || userID?.length < 30) {
invalidFields.push('userID');
if (userID.length < 30) errors.push(`userID must be at least 30 characters long`);
if (userID?.length < 30) errors.push(`userID must be at least 30 characters long`);
}
if (!Array.isArray(segments) || segments.length < 1) {
invalidFields.push('segments');