Skip to content

Commit 2ead3aa

Browse files
authored
Merge pull request #200 from sezna/main
Use clean user agent string instead of `appVersion` when `userAgentData` is unavailable.
2 parents 9a607fb + 90945ca commit 2ead3aa

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/browser/telemetryReporter.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ function getBrowserRelease(navigator: Navigator): string {
1414
const browser = navigator.userAgentData.brands[navigator.userAgentData.brands.length - 1];
1515
return `${navigator.userAgentData.platform} - ${browser?.brand} v${browser?.version}}`;
1616
} else {
17-
return navigator.appVersion;
17+
// clean the user agent using the logic from here:
18+
// https://github.com/microsoft/vscode/blob/main/src/vs/workbench/services/telemetry/browser/workbenchCommonProperties.ts#L14C1-L21C2
19+
return navigator.userAgent.replace(/(\d+\.\d+)(\.\d+)+/g, "$1");
1820
}
1921
}
2022

0 commit comments

Comments
 (0)