mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-04 15:25:47 +01:00
Issue Reporter: display message if url length exceeds limits, #42603
This commit is contained in:
@@ -435,7 +435,18 @@ export class IssueReporter extends Disposable {
|
||||
const queryStringPrefix = product.reportIssueUrl.indexOf('?') === -1 ? '?' : '&';
|
||||
const baseUrl = `${product.reportIssueUrl}${queryStringPrefix}title=${issueTitle}&body=`;
|
||||
const issueBody = this.issueReporterModel.serialize();
|
||||
shell.openExternal(baseUrl + encodeURIComponent(issueBody));
|
||||
const url = baseUrl + encodeURIComponent(issueBody);
|
||||
|
||||
const lengthValidationElement = document.getElementById('url-length-validation-error');
|
||||
if (url.length > 2081) {
|
||||
lengthValidationElement.textContent = localize('urlLengthError', "The data exceeds the length limit of 2081. The data is length {0}.", url.length);
|
||||
show(lengthValidationElement);
|
||||
return false;
|
||||
} else {
|
||||
hide(lengthValidationElement);
|
||||
}
|
||||
|
||||
shell.openExternal(url);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,10 +58,7 @@ ${this._data.issueDescription}
|
||||
VS Code version: ${this._data.versionInfo && this._data.versionInfo.vscodeVersion}
|
||||
OS version: ${this._data.versionInfo && this._data.versionInfo.os}
|
||||
|
||||
${this.getInfos()}
|
||||
|
||||
<!-- Generated by VS Code Issue Helper -->
|
||||
`;
|
||||
${this.getInfos()}`;
|
||||
}
|
||||
|
||||
private getIssueTypeTitle(): string {
|
||||
@@ -168,20 +165,12 @@ ${this._data.workspaceInfo};
|
||||
return `${e.manifest.name}|${e.manifest.publisher.substr(0, 3)}|${e.manifest.version}`;
|
||||
}).join('\n');
|
||||
|
||||
const extensionTable = `<details><summary>Extensions (${this._data.enabledNonThemeExtesions.length})</summary>
|
||||
return `<details><summary>Extensions (${this._data.enabledNonThemeExtesions.length})</summary>
|
||||
|
||||
${tableHeader}
|
||||
${table}
|
||||
${themeExclusionStr}
|
||||
|
||||
</details>`;
|
||||
|
||||
// 2000 chars is browsers de-facto limit for URLs, 400 chars are allowed for other string parts of the issue URL
|
||||
// http://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers
|
||||
if (encodeURIComponent(extensionTable).length > 1600) {
|
||||
return 'the listing length exceeds browsers\' URL characters limit';
|
||||
}
|
||||
|
||||
return extensionTable;
|
||||
}
|
||||
}
|
||||
@@ -129,5 +129,8 @@ export default (): string => `
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="url-length-validation-error" class="validation-error hidden" role="alert">
|
||||
<-- To be dynamically filled -->
|
||||
</div>
|
||||
<button id="github-submit-btn" disabled>${escape(localize('loadingData', "Loading data..."))}</button>
|
||||
</div>`;
|
||||
@@ -26,9 +26,6 @@ undefined
|
||||
VS Code version: undefined
|
||||
OS version: undefined
|
||||
|
||||
|
||||
|
||||
<!-- Generated by VS Code Issue Helper -->
|
||||
`);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user