Skip to content

Commit

Permalink
styles(prettier)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kathund committed Feb 8, 2024
1 parent 24ce0ee commit 7bfe42f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 18 deletions.
10 changes: 4 additions & 6 deletions src/endpoints/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
10 changes: 4 additions & 6 deletions src/endpoints/raw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
10 changes: 4 additions & 6 deletions src/endpoints/save.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 7bfe42f

Please sign in to comment.