This commit is contained in:
Flummi 2017-03-15 11:23:07 +01:00
parent 28fa0b2d6b
commit 0f64a25ae7

View File

@ -139,9 +139,8 @@ module.exports = (lib) => {
if(!err) { if(!err) {
var type = res.headers['content-type']; var type = res.headers['content-type'];
lib.log('MimeType: '+type); lib.log('MimeType: '+type);
var length = res.headers['content-length'];
if(lib.cfg.main.allowedMimes.hasOwnProperty(type)) { if(lib.cfg.main.allowedMimes.hasOwnProperty(type)) {
if( ( data.length <= lib.cfg.main.maxFileSize ) || force || ( userlevel >= 70 && res.headers['content-length'] >= (lib.cfg.main.maxFileSize * 2) ) ) { if( ( data.length <= lib.cfg.main.maxFileSize ) || force || ( userlevel >= 70 && data.length >= (lib.cfg.main.maxFileSize * 2) ) ) {
var s = new Readable var s = new Readable
s.push(data); s.push(data);
s.push(null); s.push(null);
@ -175,7 +174,7 @@ module.exports = (lib) => {
.on('finish', () => { .on('finish', () => {
var size = dat.bytesWritten; var size = dat.bytesWritten;
dat.end(); dat.end();
if( ( size <= lib.cfg.main.maxFileSize ) || force || ( userlevel >= 70 && res.headers['content-length'] >= (lib.cfg.main.maxFileSize * 2) ) ) { if( ( size <= lib.cfg.main.maxFileSize ) || force || ( userlevel >= 70 && size <= (lib.cfg.main.maxFileSize * 2) ) ) {
fs.stat('./b/' + tmpdest, (err, stat) => { fs.stat('./b/' + tmpdest, (err, stat) => {
if(!err && stat.isFile() && stat.size > 300) { if(!err && stat.isFile() && stat.size > 300) {
lib.log('Datei '+tmpdest+' existiert'); lib.log('Datei '+tmpdest+' existiert');