diff --git a/ts/logging/debuglogs.ts b/ts/logging/debuglogs.ts index 6b503242f1..9b32d867cb 100644 --- a/ts/logging/debuglogs.ts +++ b/ts/logging/debuglogs.ts @@ -43,9 +43,11 @@ export const uploadDebugLogs = async ( const signedForm = await got.get(BASE_URL, { json: true, headers }); const { fields, url } = parseTokenBody(signedForm.body); + const uploadKey = `${fields.key}.gz`; + const form = new FormData(); // The API expects `key` to be the first field: - form.append('key', fields.key); + form.append('key', uploadKey); Object.entries(fields) .filter(([key]) => key !== 'key') .forEach(([key, value]) => { @@ -76,5 +78,5 @@ export const uploadDebugLogs = async ( } window.log.info('Debug log upload complete.'); - return `${BASE_URL}/${fields.key}`; + return `${BASE_URL}/${uploadKey}`; }; diff --git a/ts/test-node/logging/uploadDebugLogs_test.ts b/ts/test-node/logging/uploadDebugLogs_test.ts index 581edb40e7..1ad52607e9 100644 --- a/ts/test-node/logging/uploadDebugLogs_test.ts +++ b/ts/test-node/logging/uploadDebugLogs_test.ts @@ -40,7 +40,7 @@ describe('uploadDebugLogs', () => { it('makes a request to get the S3 bucket, then uploads it there', async function test() { assert.strictEqual( await uploadDebugLogs('hello world', '1.2.3'), - 'https://debuglogs.org/abc123' + 'https://debuglogs.org/abc123.gz' ); sinon.assert.calledOnce(this.fakeGet); diff --git a/ts/util/lint/exceptions.json b/ts/util/lint/exceptions.json index d8c83afaff..69b91504a3 100644 --- a/ts/util/lint/exceptions.json +++ b/ts/util/lint/exceptions.json @@ -14138,7 +14138,7 @@ { "rule": "jQuery-append(", "path": "ts/logging/debuglogs.js", - "line": " form.append('key', fields.key);", + "line": " form.append('key', uploadKey);", "reasonCategory": "falseMatch", "updated": "2020-12-17T18:08:07.752Z" }, @@ -14166,7 +14166,7 @@ { "rule": "jQuery-append(", "path": "ts/logging/debuglogs.ts", - "line": " form.append('key', fields.key);", + "line": " form.append('key', uploadKey);", "reasonCategory": "falseMatch", "updated": "2020-12-17T18:08:07.752Z" }, @@ -14308,4 +14308,4 @@ "updated": "2021-03-18T21:41:28.361Z", "reasonDetail": "A generic hook. Typically not to be used with non-DOM values." } -] +] \ No newline at end of file