Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Add snackbar error message when .gpg-id contains a short hex id #2819

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@
<string name="otp_import_failure_no_selection">No image file was selected</string>
<string name="exporting_passwords">Exporting passwords…</string>
<string name="invalid_gpg_id">Found .gpg-id, but it contains an invalid key ID, fingerprint or user ID</string>
<string name="short_gpg_id">Found .gpg-id, but it contains a short hex ID, which is not supported</string>
<string name="invalid_filename_text">File name must not contain \'/\', set directory above</string>
<string name="directory_hint">Directory</string>
<string name="new_folder_set_gpg_key">Set GPG key for directory</string>
Expand Down