From 7bfe42fd13caac117d5cd1159f5b7b9ff1d26480 Mon Sep 17 00:00:00 2001 From: Kath <55346310+Kathund@users.noreply.github.com> Date: Thu, 8 Feb 2024 09:30:04 +0800 Subject: [PATCH] styles(prettier) --- src/endpoints/delete.ts | 10 ++++------ src/endpoints/raw.ts | 10 ++++------ src/endpoints/save.ts | 10 ++++------ 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/src/endpoints/delete.ts b/src/endpoints/delete.ts index 8575d17..d1229d9 100644 --- a/src/endpoints/delete.ts +++ b/src/endpoints/delete.ts @@ -16,12 +16,10 @@ export default (app: Application) => { const fileName = req.params.name; const fileNamePattern = /^[a-zA-Z0-9]+\.(jpg|jpeg|png|mp4)$/; if (!fileNamePattern.test(fileName)) { - return res - .status(400) - .json({ - error: - 'Invalid file name. Please only use English Alphabet characters, 0-9. .jpg .jpeg .png .mp4 are the only supported file types', - }); + return res.status(400).json({ + error: + 'Invalid file name. Please only use English Alphabet characters, 0-9. .jpg .jpeg .png .mp4 are the only supported file types', + }); } const dir = resolve(dirname(''), 'src/files'); if (!existsSync(dir)) { diff --git a/src/endpoints/raw.ts b/src/endpoints/raw.ts index 4cc70f7..ac0640c 100644 --- a/src/endpoints/raw.ts +++ b/src/endpoints/raw.ts @@ -11,12 +11,10 @@ export default (app: Application) => { apiMessage(req.path, `User is trying to get a file - ${fileName}`); const fileNamePattern = /^[a-zA-Z0-9]+\.(jpg|jpeg|png|mp4)$/; if (!fileNamePattern.test(fileName)) { - return res - .status(400) - .json({ - error: - 'Invalid file name. Please only use English Alphabet characters, 0-9. .jpg .jpeg .png .mp4 are the only supported file types', - }); + return res.status(400).json({ + error: + 'Invalid file name. Please only use English Alphabet characters, 0-9. .jpg .jpeg .png .mp4 are the only supported file types', + }); } const dir = resolve(dirname(''), 'src/files'); if (!existsSync(dir)) { diff --git a/src/endpoints/save.ts b/src/endpoints/save.ts index 1ce30bc..e184c39 100644 --- a/src/endpoints/save.ts +++ b/src/endpoints/save.ts @@ -22,12 +22,10 @@ export default (app: Application) => { const fileName = nameHide ? `${generateID(10)}.${req.params.name.split('.')[1]}` : req.params.name; const fileNamePattern = /^[a-zA-Z0-9]+\.(jpg|jpeg|png|mp4)$/; if (!fileNamePattern.test(fileName)) { - return res - .status(400) - .json({ - error: - 'Invalid file name. Please only use English Alphabet characters, 0-9. .jpg .jpeg .png .mp4 are the only supported file types', - }); + return res.status(400).json({ + error: + 'Invalid file name. Please only use English Alphabet characters, 0-9. .jpg .jpeg .png .mp4 are the only supported file types', + }); } if (file.size > maxFileSize) { errorMessage('File is too big');