fix: project created without extension

This commit is contained in:
Carlos Valente
2025-02-07 10:35:47 +01:00
committed by Carlos Valente
parent af177060ff
commit 31799f8fab
3 changed files with 8 additions and 6 deletions
+2 -2
View File
@@ -7,6 +7,7 @@ import { ensureJsonExtension } from '../../utils/fileManagement.js';
* @description Validates request for a new project.
*/
export const validateNewProject = [
body('filename').optional().isString().trim(),
body('title').optional().isString().trim(),
body('description').optional().isString().trim(),
body('publicUrl').optional().isString().trim(),
@@ -132,8 +133,7 @@ export const validateFilenameParam = [
.customSanitizer((input: string) => sanitize(input))
.withMessage('Failed to sanitize the filename')
.notEmpty()
.withMessage('Filename was empty or contained only invalid characters')
.customSanitizer((input: string) => ensureJsonExtension(input)),
.withMessage('Filename was empty or contained only invalid characters'),
(req: Request, res: Response, next: NextFunction) => {
const errors = validationResult(req);