Skip to content

Commit 6993a4a

Browse files
committed
Fix incorrect newline handling in error reporter
Issue duplicate detection didn't handle cases where the stacktrace contained different newline characters. Resolves #456
1 parent 62b2d5d commit 6993a4a

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/main/kotlin/com/demonwav/mcdev/error/AnonymousFeedback.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ object AnonymousFeedback {
109109
val list = getAllIssues("https://api.github.com/repos/minecraft-dev/MinecraftDev/issues" +
110110
"?state=all&creator=minecraft-dev-autoreporter&per_page=100", factory) ?: return null
111111
val block = list.firstOrNull {
112-
val body = it["body"] as? String ?: return@firstOrNull false
112+
val body = (it["body"] as? String ?: return@firstOrNull false).replace(Regex("[\r\n]+"), "\n")
113113

114114
// We can't comment on locked issues
115115
if (it["locked"] as Boolean) {

src/main/kotlin/com/demonwav/mcdev/error/ErrorBean.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import com.intellij.util.ExceptionUtil
1515

1616
// It's easier to just re-use the code that we already were using, rather than changing to a map like
1717
// Jetbrains said to do in the deprecation message
18-
class ErrorBean(throwable: Throwable?, val lastAction: String) {
18+
class ErrorBean(throwable: Throwable?, val lastAction: String?) {
1919

2020
val stackTrace: String? = if (throwable != null) ExceptionUtil.getThrowableText(throwable) else null
2121
var message: String? = null

src/main/kotlin/com/demonwav/mcdev/error/IdeaITNProxy.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ object IdeaITNProxy {
3636
params["App Build"] = appInfo.build.asString()
3737
params["App Version"] = appInfo.fullVersion
3838

39-
if (error.lastAction.isBlank()) {
39+
if (error.lastAction.isNullOrBlank()) {
4040
params["Last Action"] = "None"
4141
} else {
4242
params["Last Action"] = error.lastAction

0 commit comments

Comments
 (0)