file type validation
This commit is contained in:
parent
cf3cfc380a
commit
1315e80566
@ -78,6 +78,7 @@ class Client extends EventEmitter {
|
||||
if (['corgi.wtf', 'localhost'].some((x) => origin.includes(x))) {
|
||||
return cb(null, true);
|
||||
}
|
||||
this.logger.warn(`Unauthorised origin: ${origin}`);
|
||||
return cb('Unauthorised origin', false);
|
||||
}
|
||||
}));
|
||||
|
@ -26,10 +26,11 @@ class Login extends APIEndpoint {
|
||||
async upload(req, res) {
|
||||
|
||||
const { body: { name }, files: { file } } = req;
|
||||
if (!file) res.status(400).end();
|
||||
if (!file) return res.status(400).end();
|
||||
|
||||
if (!file.mimetype !== 'video/mp4' || !file.name.endsWith('.mp4')) return res.status(400).send('Invalid type');
|
||||
|
||||
this.logger.info(`${req.user.username}#${req.user.discriminator} is uploading ${name}`);
|
||||
|
||||
try {
|
||||
await this.client.clipIndex.add(file, name, req.user);
|
||||
res.status(200).end();
|
||||
|
Loading…
Reference in New Issue
Block a user