mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-09 12:18:11 +08:00
Fix long crash stack traces breaking the GitHub URL
This commit is contained in:
@@ -23,6 +23,7 @@ export function createPanicManager(editor: Editor, dialogState: DialogState) {
|
||||
export function githubUrl(panicDetails: string): string {
|
||||
const url = new URL("https://github.com/GraphiteEditor/Graphite/issues/new");
|
||||
|
||||
const buildUrl = (includeCrashReport: boolean) => {
|
||||
let body = stripIndents`
|
||||
**Describe the Crash**
|
||||
Explain clearly what you were doing when the crash occurred.
|
||||
@@ -45,8 +46,12 @@ export function githubUrl(panicDetails: string): string {
|
||||
Copied from the crash dialog in the Graphite editor:
|
||||
`;
|
||||
|
||||
const manualCopyStackTraceNotice = stripIndents`
|
||||
Before submitting this bug, REPLACE THIS WITH THE LOG. Return to the editor and click "Copy Error Log" in the crash dialog and paste it in place of this text.
|
||||
`;
|
||||
|
||||
body += "\n\n```\n";
|
||||
body += panicDetails.trimEnd();
|
||||
body += includeCrashReport ? panicDetails.trimEnd() : manualCopyStackTraceNotice;
|
||||
body += "\n```";
|
||||
|
||||
const fields = {
|
||||
@@ -64,4 +69,12 @@ export function githubUrl(panicDetails: string): string {
|
||||
});
|
||||
|
||||
return url.toString();
|
||||
};
|
||||
|
||||
let urlString = buildUrl(true);
|
||||
if (urlString.length >= 8192) {
|
||||
// Fall back to a shorter version if it exceeds GitHub limits of 8192 total characters
|
||||
urlString = buildUrl(false);
|
||||
}
|
||||
return urlString;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user