mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-07 00:13:53 +00:00
fix: ensure filename sanitation in all routes
This commit is contained in:
committed by
Carlos Valente
parent
0e770655dc
commit
902edf4a85
@@ -8,6 +8,7 @@ import {
|
||||
import { getErrorMessage } from 'ontime-utils';
|
||||
|
||||
import type { Request, Response } from 'express';
|
||||
import sanitize from 'sanitize-filename';
|
||||
|
||||
import {
|
||||
doesProjectExist,
|
||||
@@ -74,7 +75,8 @@ export async function createProjectFile(req: Request, res: Response<{ filename:
|
||||
*/
|
||||
export async function quickProjectFile(req: Request, res: Response<{ filename: string } | ErrorResponse>) {
|
||||
try {
|
||||
const filename = await projectService.createProject(req.body.project.title || 'untitled', req.body);
|
||||
const nameFromTitle = req.body.project.title ? sanitize(req.body.project.title) : 'untitled';
|
||||
const filename = await projectService.createProject(nameFromTitle, req.body);
|
||||
res.status(200).send({
|
||||
filename,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user