diff --git a/src/routes/postClearCache.ts b/src/routes/postClearCache.ts index 29979c09..e446c4b7 100644 --- a/src/routes/postClearCache.ts +++ b/src/routes/postClearCache.ts @@ -23,7 +23,7 @@ export async function postClearCache(req: Request, res: Response): Promise p + (i !== 0 ? ", " : "") + c, ""); + const fields = invalidFields.join(", "); return res.status(400).send(`No valid ${fields} field(s) provided`); } diff --git a/src/routes/postSkipSegments.ts b/src/routes/postSkipSegments.ts index 217be5c9..70ddbd83 100644 --- a/src/routes/postSkipSegments.ts +++ b/src/routes/postSkipSegments.ts @@ -242,8 +242,8 @@ async function checkInvalidFields(videoID: VideoID, userID: UserID, hashedUserID if (invalidFields.length !== 0) { // invalid request - const formattedFields = invalidFields.reduce((p, c, i) => p + (i !== 0 ? ", " : "") + c, ""); - const formattedErrors = errors.reduce((p, c, i) => p + (i !== 0 ? ". " : " ") + c, ""); + const formattedFields = invalidFields.join(", "); + const formattedErrors = errors.join(". "); return { pass: false, errorMessage: `No valid ${formattedFields}.${formattedErrors}`,