Skip to content

Commit

Permalink
Use clean user agent string instead of appVersion when userAgentData …
Browse files Browse the repository at this point in the history
…is unavailable
  • Loading branch information
sezna committed Feb 26, 2024
1 parent 997abf0 commit 90945ca
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 90945ca

Please sign in to comment.