Skip to content

Commit

Permalink
Merge pull request #200 from sezna/main
Browse files Browse the repository at this point in the history
Use clean user agent string instead of `appVersion` when `userAgentData` is unavailable.
  • Loading branch information
lramos15 authored Feb 27, 2024
2 parents 9a607fb + 90945ca commit 2ead3aa
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/browser/telemetryReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ function getBrowserRelease(navigator: Navigator): string {
const browser = navigator.userAgentData.brands[navigator.userAgentData.brands.length - 1];
return `${navigator.userAgentData.platform} - ${browser?.brand} v${browser?.version}}`;
} else {
return navigator.appVersion;
// clean the user agent using the logic from here:
// https://github.com/microsoft/vscode/blob/main/src/vs/workbench/services/telemetry/browser/workbenchCommonProperties.ts#L14C1-L21C2
return navigator.userAgent.replace(/(\d+\.\d+)(\.\d+)+/g, "$1");
}
}

Expand Down

0 comments on commit 2ead3aa

Please sign in to comment.