mirror of
https://github.com/Foltik/Shimapan
synced 2024-11-30 22:41:47 -05:00
Add file size verification in upload script
This commit is contained in:
parent
589dad32df
commit
907478e6f1
@ -25,7 +25,13 @@ function genFileName() {
|
||||
|
||||
router.post('/', dest.single('file'), function(req, res) {
|
||||
if (req.payload.scope.indexOf('file.upload') === -1) {
|
||||
res.status(401).json({'message': 'Permission error.'});
|
||||
res.status(403).json({'message': 'Permission error.'});
|
||||
return;
|
||||
}
|
||||
|
||||
// Size must be below 128 Megabytes (1024*1024*128 Bytes)
|
||||
if (req.file.size >= 134217728) {
|
||||
res.status(413).json({'message': 'File too large.'});
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user