fix: allow gpg-id to be the first line of a .gpg-id file

This commit is contained in:
Harsh Shandilya 2023-06-13 00:44:50 +05:30
parent 5871a1cb5f
commit e7982f1f0c
No known key found for this signature in database

View file

@ -168,6 +168,8 @@ open class BasePgpActivity : AppCompatActivity() {
// file we created. Skip the validation so we can make the user add a // file we created. Skip the validation so we can make the user add a
// real ID. // real ID.
if (line.isEmpty()) return@run 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()).not()) {
snackbar(message = resources.getString(R.string.invalid_gpg_id)) snackbar(message = resources.getString(R.string.invalid_gpg_id))
} }