diff --git a/appconfig/src/main/kotlin/io/element/android/appconfig/RageshakeConfig.kt b/appconfig/src/main/kotlin/io/element/android/appconfig/RageshakeConfig.kt index 1f6609ecc3..38dcd67c9e 100644 --- a/appconfig/src/main/kotlin/io/element/android/appconfig/RageshakeConfig.kt +++ b/appconfig/src/main/kotlin/io/element/android/appconfig/RageshakeConfig.kt @@ -25,4 +25,9 @@ object RageshakeConfig { * The maximum size of the upload request. Default value is just below CloudFlare's max request size. */ const val MAX_LOG_UPLOAD_SIZE = 50 * 1024 * 1024L + + /** + * The maximum size of a single log file. + */ + const val MAX_LOG_CONTENT_SIZE = 100 * 1024 * 1024L } 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 f51d699350..f238f9d6ff 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 @@ -158,6 +158,7 @@ class DefaultBugReporter( } if (withCrashLogs || withDevicesLogs) { saveLogCat() + ?.takeIf { it.length() < RageshakeConfig.MAX_LOG_CONTENT_SIZE } ?.let { logCatFile -> compressFile(logCatFile).also { logCatFile.safeDelete() @@ -191,6 +192,7 @@ class DefaultBugReporter( .addFormDataPart("label", buildMeta.versionName) .addFormDataPart("label", buildMeta.flavorDescription) .addFormDataPart("branch_name", buildMeta.gitBranchName) + userId?.let { matrixClientProvider.getOrNull(it)?.let { client -> val curveKey = client.encryptionService.deviceCurve25519() @@ -390,7 +392,11 @@ class DefaultBugReporter( ) { val logDirectory = logDirectory() logDirectory.listFiles() - ?.filter { it.isFile && !it.name.endsWith(LOG_CAT_FILENAME) } + ?.filter { + it.isFile && + !it.name.endsWith(LOG_CAT_FILENAME) && + it.length() < RageshakeConfig.MAX_LOG_CONTENT_SIZE + } }.orEmpty() }