Фикс: зашифрованные ключи не отображаются как caption в фото viewer
decryptStoredMessageText возвращал зашифрованный текст при неудачной расшифровке. Теперь возвращает пустую строку. Дополнительно: фильтр base64-like строк в caption viewer. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -637,7 +637,9 @@ fun ImageViewerScreen(
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
// 📝 CAPTION BAR - Telegram-style снизу с анимацией
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
val currentCaption = currentImage?.caption ?: ""
|
||||
val rawCaption = currentImage?.caption ?: ""
|
||||
// Filter out encrypted/garbled captions (base64 strings without spaces)
|
||||
val currentCaption = if (rawCaption.isNotBlank() && !rawCaption.contains(' ') && rawCaption.length > 40 && rawCaption.matches(Regex("^[A-Za-z0-9+/=:]+$"))) "" else rawCaption
|
||||
if (currentCaption.isNotEmpty()) {
|
||||
AnimatedVisibility(
|
||||
visible = showControls && animationState == 1 && !isClosing,
|
||||
|
||||
@@ -1391,11 +1391,11 @@ private fun extractDownloadTagFromPreview(preview: String): String {
|
||||
|
||||
private fun decryptStoredMessageText(encryptedText: String, privateKey: String): String {
|
||||
if (encryptedText.isBlank()) return ""
|
||||
if (privateKey.isBlank()) return encryptedText
|
||||
if (privateKey.isBlank()) return ""
|
||||
return try {
|
||||
CryptoManager.decryptWithPassword(encryptedText, privateKey) ?: encryptedText
|
||||
CryptoManager.decryptWithPassword(encryptedText, privateKey) ?: ""
|
||||
} catch (_: Exception) {
|
||||
encryptedText
|
||||
""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user