Skip to content

Commit

Permalink
Escape backslashes in issue reporter data, fixes #105494
Browse files Browse the repository at this point in the history
  • Loading branch information
Rachel Macfarlane committed Nov 6, 2020
1 parent be410d1 commit 5961799
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/vs/code/electron-sandbox/issue/issueReporterModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ ${this.getInfos()}
|GPU Status|${Object.keys(this._data.systemInfo.gpuStatus).map(key => `${key}: ${this._data.systemInfo!.gpuStatus[key]}`).join('<br>')}|
|Load (avg)|${this._data.systemInfo.load}|
|Memory (System)|${this._data.systemInfo.memory}|
|Process Argv|${this._data.systemInfo.processArgs}|
|Process Argv|${this._data.systemInfo.processArgs.replace(/\\/g, '\\\\')}|
|Screen Reader|${this._data.systemInfo.screenReader}|
|VM|${this._data.systemInfo.vmHint}|`;

Expand Down
39 changes: 39 additions & 0 deletions src/vs/code/electron-sandbox/issue/test/testReporterModel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,45 @@ Remote OS version: Linux x64 4.18.0
<!-- generated by issue reporter -->`);
});

test('escapes backslashes in processArgs', () => {
const issueReporterModel = new IssueReporterModel({
issueType: 0,
systemInfo: {
os: 'Darwin',
cpus: 'Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 x 2800)',
memory: '16.00GB',
vmHint: '0%',
processArgs: '\\\\HOST\\path',
screenReader: 'no',
remoteData: [],
gpuStatus: {}
}
});
assert.equal(issueReporterModel.serialize(),
`
Issue Type: <b>Bug</b>
undefined
VS Code version: undefined
OS version: undefined
<details>
<summary>System Info</summary>
|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 x 2800)|
|GPU Status||
|Load (avg)|undefined|
|Memory (System)|16.00GB|
|Process Argv|\\\\\\\\HOST\\\\path|
|Screen Reader|no|
|VM|0%|
</details>Extensions: none
<!-- generated by issue reporter -->`);
});

test('should normalize GitHub urls', () => {
[
'https://github.com/repo',
Expand Down

0 comments on commit 5961799

Please sign in to comment.