mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-07 21:18:12 +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 {
|
export function githubUrl(panicDetails: string): string {
|
||||||
const url = new URL("https://github.com/GraphiteEditor/Graphite/issues/new");
|
const url = new URL("https://github.com/GraphiteEditor/Graphite/issues/new");
|
||||||
|
|
||||||
|
const buildUrl = (includeCrashReport: boolean) => {
|
||||||
let body = stripIndents`
|
let body = stripIndents`
|
||||||
**Describe the Crash**
|
**Describe the Crash**
|
||||||
Explain clearly what you were doing when the crash occurred.
|
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:
|
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 += "\n\n```\n";
|
||||||
body += panicDetails.trimEnd();
|
body += includeCrashReport ? panicDetails.trimEnd() : manualCopyStackTraceNotice;
|
||||||
body += "\n```";
|
body += "\n```";
|
||||||
|
|
||||||
const fields = {
|
const fields = {
|
||||||
@@ -64,4 +69,12 @@ export function githubUrl(panicDetails: string): string {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return url.toString();
|
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