diff --git a/app/controllers/copy_controller.js b/app/controllers/copy_controller.js index 0b552492..e2a61df6 100644 --- a/app/controllers/copy_controller.js +++ b/app/controllers/copy_controller.js @@ -113,6 +113,7 @@ function handleCopyFrom (logger) { const streamCopy = new StreamCopy(sql, userDbParams, logger); const metrics = new StreamCopyMetrics(logger, 'copyfrom', sql, user, isGzip); + const decompress = isGzip ? zlib.createGunzip() : new PassThrough(); streamCopy.getPGStream(StreamCopy.ACTION_FROM, (err, pgstream) => { if (err) { @@ -136,6 +137,7 @@ function handleCopyFrom (logger) { metrics.end(null, err); pgstream.emit('error', err); }) + .pipe(decompress) .on('data', data => { metrics.addSize(data.length);