fix checking file early

This commit is contained in:
Emily Hou 2018-06-21 16:36:34 -07:00
parent e4a0028f5d
commit 12ccce3016
4 changed files with 6 additions and 11 deletions

View file

@ -44,13 +44,13 @@ module.exports = async function(ws, req) {
nonce: crypto.randomBytes(16).toString('base64')
};
const protocol = config.env === 'production' ? 'https' : req.protocol;
const url = `${protocol}://${req.get('host')}/download/${newId}/`;
const limiter = new Limiter(config.max_file_size);
fileStream = wsStream(ws, { binary: true }).pipe(limiter);
storage.set(newId, fileStream, meta);
const protocol = config.env === 'production' ? 'https' : req.protocol;
const url = `${protocol}://${req.get('host')}/download/${newId}/`;
ws.send(
JSON.stringify({
url,