@@ -301,7 +301,13 @@ export class BaseIssueReporterService extends Disposable {
301
301
302
302
private async sendReporterMenu ( extension : IssueReporterExtensionData ) : Promise < IssueReporterData | undefined > {
303
303
try {
304
- const data = await this . issueFormService . sendReporterMenu ( extension . id ) ;
304
+ const timeoutPromise = new Promise < undefined > ( ( _ , reject ) =>
305
+ setTimeout ( ( ) => reject ( new Error ( 'sendReporterMenu timed out' ) ) , 10000 )
306
+ ) ;
307
+ const data = await Promise . race ( [
308
+ this . issueFormService . sendReporterMenu ( extension . id ) ,
309
+ timeoutPromise
310
+ ] ) ;
305
311
return data ;
306
312
} catch ( e ) {
307
313
console . error ( e ) ;
@@ -1056,11 +1062,12 @@ export class BaseIssueReporterService extends Disposable {
1056
1062
const baseUrl = this . getIssueUrlWithTitle ( ( < HTMLInputElement > this . getElementById ( 'issue-title' ) ) . value , issueUrl ) ;
1057
1063
let url = baseUrl + `&body=${ encodeURIComponent ( issueBody ) } ` ;
1058
1064
1059
- url + = this . addTemplateToUrl ( gitHubDetails ?. owner , gitHubDetails ?. repositoryName ) ;
1065
+ url = this . addTemplateToUrl ( url , gitHubDetails ?. owner , gitHubDetails ?. repositoryName ) ;
1060
1066
1061
1067
if ( url . length > MAX_URL_LENGTH ) {
1062
1068
try {
1063
- url = await this . writeToClipboard ( baseUrl , issueBody ) + this . addTemplateToUrl ( gitHubDetails ?. owner , gitHubDetails ?. repositoryName ) ;
1069
+ url = await this . writeToClipboard ( baseUrl , issueBody ) ;
1070
+ url = this . addTemplateToUrl ( url , gitHubDetails ?. owner , gitHubDetails ?. repositoryName ) ;
1064
1071
} catch ( _ ) {
1065
1072
console . error ( 'Writing to clipboard failed' ) ;
1066
1073
return false ;
@@ -1081,24 +1088,22 @@ export class BaseIssueReporterService extends Disposable {
1081
1088
return baseUrl + `&body=${ encodeURIComponent ( localize ( 'pasteData' , "We have written the needed data into your clipboard because it was too large to send. Please paste." ) ) } ` ;
1082
1089
}
1083
1090
1084
- public addTemplateToUrl ( owner ?: string , repositoryName ?: string ) : string {
1091
+ public addTemplateToUrl ( baseUrl : string , owner ?: string , repositoryName ?: string ) : string {
1085
1092
const isVscode = this . issueReporterModel . getData ( ) . fileOnProduct ;
1086
- const isCopilot = owner ?. toLowerCase ( ) === 'microsoft' && repositoryName === 'vscode-copilot-release ';
1087
- const isPython = owner ?. toLowerCase ( ) === 'microsoft' && repositoryName === 'vscode-python' ;
1093
+ const isMicrosoft = owner ?. toLowerCase ( ) === 'microsoft' ;
1094
+ const needsTemplate = isVscode || ( isMicrosoft && ( repositoryName === 'vscode' || repositoryName === 'vscode-python' ) ) ;
1088
1095
1089
- if ( isVscode ) {
1090
- return `&template=bug_report.md` ;
1091
- }
1092
-
1093
- if ( isCopilot ) {
1094
- return `&template=bug_report_chat.md` ;
1095
- }
1096
-
1097
- if ( isPython ) {
1098
- return `&template=bug_report.md` ;
1096
+ if ( needsTemplate ) {
1097
+ try {
1098
+ const url = new URL ( baseUrl ) ;
1099
+ url . searchParams . set ( 'template' , 'bug_report.md' ) ;
1100
+ return url . toString ( ) ;
1101
+ } catch {
1102
+ // fallback if baseUrl is not a valid URL
1103
+ return baseUrl + '&template=bug_report.md' ;
1104
+ }
1099
1105
}
1100
-
1101
- return '' ;
1106
+ return baseUrl ;
1102
1107
}
1103
1108
1104
1109
public getIssueUrl ( ) : string {
0 commit comments