another bugfix #2
This commit is contained in:
parent
2788ad9e38
commit
c155a278e3
@ -50,7 +50,7 @@ module.exports = (lib) => {
|
||||
}
|
||||
else {
|
||||
fs.stat('./b/' + cb.file, (err, stat) => {
|
||||
if(err === null || err.code == 'ENOENT')
|
||||
if(err === null)
|
||||
fs.unlinkSync('./b/' + cb.file);
|
||||
if(cb.msg !== '')
|
||||
e.reply(cb.msg);
|
||||
@ -179,18 +179,22 @@ module.exports = (lib) => {
|
||||
if(size > cfg.maxFileSize)
|
||||
cb({ success: false, file: tmpdest, msg: 'f0ck! your file is too big (~'+lib.formatSize(size)+'), max '+lib.formatSize(cfg.maxFileSize)+' allowed' });
|
||||
else {
|
||||
lib.getCheckSum('./b/' + tmpdest, (cbcs) => {
|
||||
lib.checkRepostCheckSum(cbcs, (cbcrcs) => {
|
||||
if(cbcrcs === true) {
|
||||
var mime = fileType(readChunk.sync('./b/' + tmpdest, 0, 262));
|
||||
if(cfg.allowedMimes.hasOwnProperty(mime.mime) || info.type === 'soundcloud')
|
||||
cb({ success: true, info: info, size: size, file: './b/' + tmpdest, checksum: cbcs });
|
||||
else
|
||||
cb({ success: false, file: tmpdest, msg: 'lol, go f0ck yourself ('+mime+')' });
|
||||
}
|
||||
else
|
||||
cb({ success: false, file: tmpdest, msg: 'repost motherf0cker: '+cfg.url+'/'+cbcrcs });
|
||||
});
|
||||
fs.stat('./b/' + cb.file, (err, stat) => {
|
||||
if(err === null) {
|
||||
lib.getCheckSum('./b/' + tmpdest, (cbcs) => {
|
||||
lib.checkRepostCheckSum(cbcs, (cbcrcs) => {
|
||||
if(cbcrcs === true) {
|
||||
var mime = fileType(readChunk.sync('./b/' + tmpdest, 0, 262));
|
||||
if(cfg.allowedMimes.hasOwnProperty(mime.mime) || info.type === 'soundcloud')
|
||||
cb({ success: true, info: info, size: size, file: './b/' + tmpdest, checksum: cbcs });
|
||||
else
|
||||
cb({ success: false, file: tmpdest, msg: 'lol, go f0ck yourself ('+mime+')' });
|
||||
}
|
||||
else
|
||||
cb({ success: false, file: tmpdest, msg: 'repost motherf0cker: '+cfg.url+'/'+cbcrcs });
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user