Skip to content

Commit 40daf29

Browse files
committed
842: Incomplete trailing escape
1 parent 40192fb commit 40daf29

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/com/magento/idea/magento2plugin/project/diagnostic/github/GitHubNewIssueBodyBuilderUtil.java

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,22 @@ public static String buildNewBugReportBody(
5151
if (encode(stackTrace).length() <= maxAllowedStackTraceLength) {
5252
return buildTemplate(project, bugDescription, stackTrace);
5353
}
54+
boolean isFound = false;
55+
int step = 1;
56+
String encodedCutStackTrace = "";
57+
58+
while (!isFound) {
59+
final String cutStackTrace = stackTrace.substring(0, maxAllowedStackTraceLength - step);
60+
encodedCutStackTrace = encode(cutStackTrace);
61+
62+
if (encodedCutStackTrace.length() <= maxAllowedStackTraceLength) {
63+
isFound = true;
64+
} else {
65+
step += 10;
66+
}
67+
}
5468

55-
final String cutStackTrace = encode(stackTrace).substring(
56-
0,
57-
maxAllowedStackTraceLength - 1
58-
);
59-
60-
return buildTemplate(project, bugDescription, decode(cutStackTrace));
69+
return buildTemplate(project, bugDescription, decode(encodedCutStackTrace));
6170
}
6271

6372
/**

0 commit comments

Comments
 (0)