Add extension to uploaded debug log
This commit is contained in:
parent
19f8042cd3
commit
51b45ab275
3 changed files with 8 additions and 6 deletions
|
@ -43,9 +43,11 @@ export const uploadDebugLogs = async (
|
||||||
const signedForm = await got.get(BASE_URL, { json: true, headers });
|
const signedForm = await got.get(BASE_URL, { json: true, headers });
|
||||||
const { fields, url } = parseTokenBody(signedForm.body);
|
const { fields, url } = parseTokenBody(signedForm.body);
|
||||||
|
|
||||||
|
const uploadKey = `${fields.key}.gz`;
|
||||||
|
|
||||||
const form = new FormData();
|
const form = new FormData();
|
||||||
// The API expects `key` to be the first field:
|
// The API expects `key` to be the first field:
|
||||||
form.append('key', fields.key);
|
form.append('key', uploadKey);
|
||||||
Object.entries(fields)
|
Object.entries(fields)
|
||||||
.filter(([key]) => key !== 'key')
|
.filter(([key]) => key !== 'key')
|
||||||
.forEach(([key, value]) => {
|
.forEach(([key, value]) => {
|
||||||
|
@ -76,5 +78,5 @@ export const uploadDebugLogs = async (
|
||||||
}
|
}
|
||||||
window.log.info('Debug log upload complete.');
|
window.log.info('Debug log upload complete.');
|
||||||
|
|
||||||
return `${BASE_URL}/${fields.key}`;
|
return `${BASE_URL}/${uploadKey}`;
|
||||||
};
|
};
|
||||||
|
|
|
@ -40,7 +40,7 @@ describe('uploadDebugLogs', () => {
|
||||||
it('makes a request to get the S3 bucket, then uploads it there', async function test() {
|
it('makes a request to get the S3 bucket, then uploads it there', async function test() {
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
await uploadDebugLogs('hello world', '1.2.3'),
|
await uploadDebugLogs('hello world', '1.2.3'),
|
||||||
'https://debuglogs.org/abc123'
|
'https://debuglogs.org/abc123.gz'
|
||||||
);
|
);
|
||||||
|
|
||||||
sinon.assert.calledOnce(this.fakeGet);
|
sinon.assert.calledOnce(this.fakeGet);
|
||||||
|
|
|
@ -14138,7 +14138,7 @@
|
||||||
{
|
{
|
||||||
"rule": "jQuery-append(",
|
"rule": "jQuery-append(",
|
||||||
"path": "ts/logging/debuglogs.js",
|
"path": "ts/logging/debuglogs.js",
|
||||||
"line": " form.append('key', fields.key);",
|
"line": " form.append('key', uploadKey);",
|
||||||
"reasonCategory": "falseMatch",
|
"reasonCategory": "falseMatch",
|
||||||
"updated": "2020-12-17T18:08:07.752Z"
|
"updated": "2020-12-17T18:08:07.752Z"
|
||||||
},
|
},
|
||||||
|
@ -14166,7 +14166,7 @@
|
||||||
{
|
{
|
||||||
"rule": "jQuery-append(",
|
"rule": "jQuery-append(",
|
||||||
"path": "ts/logging/debuglogs.ts",
|
"path": "ts/logging/debuglogs.ts",
|
||||||
"line": " form.append('key', fields.key);",
|
"line": " form.append('key', uploadKey);",
|
||||||
"reasonCategory": "falseMatch",
|
"reasonCategory": "falseMatch",
|
||||||
"updated": "2020-12-17T18:08:07.752Z"
|
"updated": "2020-12-17T18:08:07.752Z"
|
||||||
},
|
},
|
||||||
|
@ -14308,4 +14308,4 @@
|
||||||
"updated": "2021-03-18T21:41:28.361Z",
|
"updated": "2021-03-18T21:41:28.361Z",
|
||||||
"reasonDetail": "A generic hook. Typically not to be used with non-DOM values."
|
"reasonDetail": "A generic hook. Typically not to be used with non-DOM values."
|
||||||
}
|
}
|
||||||
]
|
]
|
Loading…
Add table
Reference in a new issue