Add extension to uploaded debug log

This commit is contained in:
Fedor Indutny 2021-06-01 15:16:10 -07:00 committed by GitHub
parent 19f8042cd3
commit 51b45ab275
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 6 deletions

View File

@ -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}`;
};

View File

@ -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);

View File

@ -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."
}
]
]