From 97bc1e0ce52fc8411b252ae912bac40d29feee64 Mon Sep 17 00:00:00 2001 From: Mathias Rav Date: Sat, 16 Dec 2023 17:11:26 +0100 Subject: Add snackbar error message when .gpg-id contains a short hex id (#2819) --- app/src/main/java/app/passwordstore/ui/crypto/BasePGPActivity.kt | 4 +++- app/src/main/res/values/strings.xml | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/src/main/java/app/passwordstore/ui/crypto/BasePGPActivity.kt b/app/src/main/java/app/passwordstore/ui/crypto/BasePGPActivity.kt index d0039d52..7fa56333 100644 --- a/app/src/main/java/app/passwordstore/ui/crypto/BasePGPActivity.kt +++ b/app/src/main/java/app/passwordstore/ui/crypto/BasePGPActivity.kt @@ -170,7 +170,9 @@ open class BasePGPActivity : AppCompatActivity() { if (line.isEmpty()) return@run // Apparently `gpg-id` being the first line is also acceptable? if (line == "gpg-id") return@run - if (line.removePrefix("0x").matches("[a-fA-F0-9]{8}".toRegex()).not()) { + if (line.removePrefix("0x").matches("[a-fA-F0-9]{8}".toRegex())) { + snackbar(message = resources.getString(R.string.short_gpg_id)) + } else { snackbar(message = resources.getString(R.string.invalid_gpg_id)) } return null diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 21ad8845..acb07b5e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -305,6 +305,7 @@ No image file was selected Exporting passwords… Found .gpg-id, but it contains an invalid key ID, fingerprint or user ID + Found .gpg-id, but it contains a short hex ID, which is not supported File name must not contain \'/\', set directory above Directory Set GPG key for directory -- cgit v1.2.3