Debug Logs: gzip before upload

This commit is contained in:
Ken Powers 2020-03-20 17:27:31 -04:00 committed by Scott Nonnenberg
parent 4a8f5db0a4
commit a1270867ff
5 changed files with 20 additions and 20 deletions

View file

@ -3,6 +3,8 @@
const FormData = require('form-data');
const got = require('got');
const pify = require('pify');
const { gzip } = require('zlib');
const BASE_URL = 'https://debuglogs.org';
const VERSION = window.getVersion();
@ -52,12 +54,12 @@ exports.upload = async content => {
form.append(key, value);
});
const contentBuffer = Buffer.from(content, 'utf8');
const contentType = 'text/plain';
const contentBuffer = await pify(gzip)(Buffer.from(content, 'utf8'));
const contentType = 'application/gzip';
form.append('Content-Type', contentType);
form.append('file', contentBuffer, {
contentType,
filename: `signal-desktop-debug-log-${VERSION}.txt`,
filename: `signal-desktop-debug-log-${VERSION}.txt.gz`,
});
window.log.info('Debug log upload starting...');

View file

@ -212,7 +212,6 @@
"eslint-plugin-import": "2.8.0",
"eslint-plugin-mocha": "4.12.1",
"eslint-plugin-more": "0.3.1",
"extract-zip": "1.6.6",
"file-loader": "4.2.0",
"grunt": "1.0.1",
"grunt-cli": "1.2.0",

View file

@ -207,25 +207,25 @@
"rule": "jQuery-append(",
"path": "js/modules/debuglogs.js",
"line": " form.append('key', fields.key);",
"lineNumber": 48,
"lineNumber": 50,
"reasonCategory": "falseMatch",
"updated": "2018-09-19T18:13:29.628Z"
"updated": "2020-03-20T20:40:34.498Z"
},
{
"rule": "jQuery-append(",
"path": "js/modules/debuglogs.js",
"line": " form.append(key, value);",
"lineNumber": 52,
"lineNumber": 54,
"reasonCategory": "falseMatch",
"updated": "2018-09-19T18:13:29.628Z"
"updated": "2020-03-20T20:40:34.498Z"
},
{
"rule": "jQuery-append(",
"path": "js/modules/debuglogs.js",
"line": " form.append('Content-Type', contentType);",
"lineNumber": 57,
"lineNumber": 59,
"reasonCategory": "falseMatch",
"updated": "2018-09-19T18:13:29.628Z"
"updated": "2020-03-20T20:40:34.498Z"
},
{
"rule": "jQuery-load(",

View file

@ -153,7 +153,6 @@ const excludedFiles = [
'^node_modules/eslint*',
'^node_modules/esprima/*',
'^node_modules/express/*',
'^node_modules/extract-zip/*',
'^node_modules/file-loader/*',
'^node_modules/file-system-cache/*', // Currently only used in storybook
'^node_modules/finalhandler/*',

View file

@ -6978,15 +6978,6 @@ extglob@^2.0.4:
snapdragon "^0.8.1"
to-regex "^3.0.1"
extract-zip@1.6.6, extract-zip@^1.6.5:
version "1.6.6"
resolved "https://registry.yarnpkg.com/extract-zip/-/extract-zip-1.6.6.tgz#1290ede8d20d0872b429fd3f351ca128ec5ef85c"
dependencies:
concat-stream "1.6.0"
debug "2.6.9"
mkdirp "0.5.0"
yauzl "2.4.1"
extract-zip@^1.0.3:
version "1.6.0"
resolved "https://registry.yarnpkg.com/extract-zip/-/extract-zip-1.6.0.tgz#7f400c9607ea866ecab7aa6d54fb978eeb11621a"
@ -6996,6 +6987,15 @@ extract-zip@^1.0.3:
mkdirp "0.5.0"
yauzl "2.4.1"
extract-zip@^1.6.5:
version "1.6.6"
resolved "https://registry.yarnpkg.com/extract-zip/-/extract-zip-1.6.6.tgz#1290ede8d20d0872b429fd3f351ca128ec5ef85c"
dependencies:
concat-stream "1.6.0"
debug "2.6.9"
mkdirp "0.5.0"
yauzl "2.4.1"
extsprintf@1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.0.2.tgz#e1080e0658e300b06294990cc70e1502235fd550"