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(
435435 async ( params : ShowDocumentParams ) : Promise < ShowDocumentParams | ResponseError < ShowDocumentResult > > => {
436436 try {
437437 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+
438453 const doc = await vscode . workspace . openTextDocument ( uri )
439454 await vscode . window . showTextDocument ( doc , { preview : false } )
440455 return params
Original file line number Diff line number Diff line change @@ -215,8 +215,11 @@ export function reloadWindowPrompt(message: string): void {
215215 * if user dismisses the vscode confirmation prompt.
216216 */
217217export 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+
218221 return telemetry . aws_openUrl . run ( async ( span ) => {
219- span . record ( { url : url . toString ( ) , source } )
222+ span . record ( { url : truncatedUrl , source } )
220223 const didOpen = await vscode . env . openExternal ( url )
221224 if ( ! didOpen ) {
222225 throw new CancellationError ( 'user' )
You can’t perform that action at this time.
0 commit comments