From 1f6f3df0f23d4410af75d7652e2f1ce1e2f881a5 Mon Sep 17 00:00:00 2001 From: Alex Christoffer Rasmussen Date: Tue, 18 Feb 2025 21:25:36 +0100 Subject: [PATCH] ensure extension during rename and delete (#1508) --- apps/server/src/api-data/db/db.validation.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/server/src/api-data/db/db.validation.ts b/apps/server/src/api-data/db/db.validation.ts index e864bd937..c04a48d7b 100644 --- a/apps/server/src/api-data/db/db.validation.ts +++ b/apps/server/src/api-data/db/db.validation.ts @@ -133,7 +133,8 @@ export const validateFilenameParam = [ .customSanitizer((input: string) => sanitize(input)) .withMessage('Failed to sanitize the filename') .notEmpty() - .withMessage('Filename was empty or contained only invalid characters'), + .withMessage('Filename was empty or contained only invalid characters') + .customSanitizer((input: string) => ensureJsonExtension(input)), (req: Request, res: Response, next: NextFunction) => { const errors = validationResult(req);