File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
core/src/shared/utilities Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -435,6 +435,21 @@ export function registerMessageListeners(
435
435
async ( params : ShowDocumentParams ) : Promise < ShowDocumentParams | ResponseError < ShowDocumentResult > > => {
436
436
try {
437
437
const uri = vscode . Uri . parse ( params . uri )
438
+
439
+ if ( params . external ) {
440
+ // Note: Not using openUrl() because we probably don't want telemetry for these URLs.
441
+ // Also it doesn't yet support the required HACK below.
442
+
443
+ // HACK: workaround vscode bug: https://github.com/microsoft/vscode/issues/85930
444
+ vscode . env . openExternal ( params . uri as any ) . then ( undefined , ( e ) => {
445
+ // TODO: getLogger('?').error('failed vscode.env.openExternal: %O', e)
446
+ vscode . env . openExternal ( uri ) . then ( undefined , ( e ) => {
447
+ // TODO: getLogger('?').error('failed vscode.env.openExternal: %O', e)
448
+ } )
449
+ } )
450
+ return params
451
+ }
452
+
438
453
const doc = await vscode . workspace . openTextDocument ( uri )
439
454
await vscode . window . showTextDocument ( doc , { preview : false } )
440
455
return params
Original file line number Diff line number Diff line change @@ -215,8 +215,11 @@ export function reloadWindowPrompt(message: string): void {
215
215
* if user dismisses the vscode confirmation prompt.
216
216
*/
217
217
export async function openUrl ( url : vscode . Uri , source ?: string ) : Promise < boolean > {
218
+ // Avoid PII in URL.
219
+ const truncatedUrl = `${ url . scheme } ${ url . authority } ${ url . path } ${ url . fragment . substring ( 20 ) } `
220
+
218
221
return telemetry . aws_openUrl . run ( async ( span ) => {
219
- span . record ( { url : url . toString ( ) , source } )
222
+ span . record ( { url : truncatedUrl , source } )
220
223
const didOpen = await vscode . env . openExternal ( url )
221
224
if ( ! didOpen ) {
222
225
throw new CancellationError ( 'user' )
You can’t perform that action at this time.
0 commit comments