Fix false positive on string template suspicious usage.

This commit is contained in:
Benoit Marty 2022-08-16 16:03:54 +02:00 committed by Benoit Marty
parent 6089d24409
commit ea465a1b86
5 changed files with 8 additions and 8 deletions

View file

@ -93,7 +93,7 @@ internal class SessionRealmConfigurationFactory @Inject constructor(
return
}
listOf(REALM_NAME, "$REALM_NAME.lock", "$REALM_NAME.note", "$REALM_NAME.management").forEach { file ->
listOf(REALM_NAME, "${REALM_NAME}.lock", "${REALM_NAME}.note", "${REALM_NAME}.management").forEach { file ->
try {
File(directory, file).deleteRecursively()
} catch (e: Exception) {

View file

@ -83,7 +83,7 @@ private fun useMediaStoreScreenshotStorage(
screenshotLocation: String,
bitmap: Bitmap
) {
contentValues.put(MediaStore.MediaColumns.DISPLAY_NAME, "$screenshotName.jpeg")
contentValues.put(MediaStore.MediaColumns.DISPLAY_NAME, "${screenshotName}.jpeg")
contentValues.put(MediaStore.Images.Media.RELATIVE_PATH, screenshotLocation)
val uri: Uri? = contentResolver.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, contentValues)
if (uri != null) {
@ -104,7 +104,7 @@ private fun usePublicExternalScreenshotStorage(
if (!directory.exists()) {
directory.mkdirs()
}
val file = File(directory, "$screenshotName.jpeg")
val file = File(directory, "${screenshotName}.jpeg")
saveScreenshotToStream(bitmap, FileOutputStream(file))
contentResolver.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, contentValues)
}

View file

@ -175,7 +175,7 @@ fun Fragment.queryExportKeys(userId: String, activityResultLauncher: ActivityRes
selectTxtFileToWrite(
activity = requireActivity(),
activityResultLauncher = activityResultLauncher,
defaultFileName = "$appName-megolm-export-$userId-$timestamp.txt",
defaultFileName = "$appName-megolm-export-$userId-${timestamp}.txt",
chooserHint = getString(R.string.keys_backup_setup_step1_manual_export)
)
}
@ -187,7 +187,7 @@ fun Activity.queryExportKeys(userId: String, activityResultLauncher: ActivityRes
selectTxtFileToWrite(
activity = this,
activityResultLauncher = activityResultLauncher,
defaultFileName = "$appName-megolm-export-$userId-$timestamp.txt",
defaultFileName = "$appName-megolm-export-$userId-${timestamp}.txt",
chooserHint = getString(R.string.keys_backup_setup_step1_manual_export)
)
}

View file

@ -134,7 +134,7 @@ class KeysBackupSetupStep3Fragment @Inject constructor() : VectorBaseFragment<Fr
selectTxtFileToWrite(
activity = requireActivity(),
activityResultLauncher = saveRecoveryActivityResultLauncher,
defaultFileName = "recovery-key-$userId-$timestamp.txt",
defaultFileName = "recovery-key-$userId-${timestamp}.txt",
chooserHint = getString(R.string.save_recovery_key_chooser_hint)
)
dialog.dismiss()

View file

@ -74,7 +74,7 @@ class VectorFileLogger @Inject constructor(
}
for (i in 0..15) {
val file = File(cacheDirectory, "elementLogs.$i.txt")
val file = File(cacheDirectory, "elementLogs.${i}.txt")
tryOrNull { file.delete() }
}
@ -121,7 +121,7 @@ class VectorFileLogger @Inject constructor(
?.flush()
?.let { 0 until logRotationCount }
?.mapNotNull { index ->
File(cacheDirectory, "$fileNamePrefix.$index.txt")
File(cacheDirectory, "$fileNamePrefix.${index}.txt")
.takeIf { it.exists() }
}
}