From de8d3aa6950dc2a0b6b658ec96edd08d8b860293 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 16 Jan 2026 15:55:23 +0100 Subject: [PATCH] Include the number of omitted logs (if > 0) in the bug report. --- .../rageshake/impl/reporter/DefaultBugReporter.kt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/reporter/DefaultBugReporter.kt b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/reporter/DefaultBugReporter.kt index f238f9d6ff..109afe1df7 100755 --- a/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/reporter/DefaultBugReporter.kt +++ b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/reporter/DefaultBugReporter.kt @@ -147,14 +147,19 @@ class DefaultBugReporter( } } val gzippedFiles = mutableListOf() + var filesTooBig = 0 if (withDevicesLogs) { val files = getLogFiles().sortedByDescending { it.lastModified() } - files.mapNotNullTo(gzippedFiles) { file -> + val filesBySize = files.groupBy { + it.length() < RageshakeConfig.MAX_LOG_CONTENT_SIZE + } + filesBySize[true].orEmpty().mapNotNullTo(gzippedFiles) { file -> when { file.extension == "gz" -> file else -> compressFile(file) } } + filesTooBig = filesBySize[false].orEmpty().size } if (withCrashLogs || withDevicesLogs) { saveLogCat() @@ -192,7 +197,9 @@ class DefaultBugReporter( .addFormDataPart("label", buildMeta.versionName) .addFormDataPart("label", buildMeta.flavorDescription) .addFormDataPart("branch_name", buildMeta.gitBranchName) - + if (filesTooBig > 0) { + builder.addFormDataPart("omitted_logs", filesTooBig.toString()) + } userId?.let { matrixClientProvider.getOrNull(it)?.let { client -> val curveKey = client.encryptionService.deviceCurve25519() @@ -394,8 +401,7 @@ class DefaultBugReporter( logDirectory.listFiles() ?.filter { it.isFile && - !it.name.endsWith(LOG_CAT_FILENAME) && - it.length() < RageshakeConfig.MAX_LOG_CONTENT_SIZE + !it.name.endsWith(LOG_CAT_FILENAME) } }.orEmpty() }