aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2020-12-10 21:06:45 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2020-12-21 20:28:55 +0530
commitb0afe8adaa4c8043798120f8638fe95153572857 (patch)
treeb5619f44d76846fd77bca9d7c02dc769929ee269
parent964d05fdfe12e2095330b1e59e628690b5e3c29b (diff)
Try to fix missing `.gpg-id` files as well (#1246)
(cherry picked from commit c02ad427be3652298f4a07a5f1a0d68e4ac44c45) Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
-rw-r--r--CHANGELOG.md4
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt5
-rw-r--r--app/src/main/res/values-fr/strings.xml1
-rw-r--r--app/src/main/res/values-pt-rBR/strings.xml1
-rw-r--r--app/src/main/res/values-ru/strings.xml1
-rw-r--r--app/src/main/res/values/strings.xml1
6 files changed, 5 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1127ab45..d10fb572 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
## [Unreleased]
+### Added
+
+- Invalid `.gpg-id` files can now be fixed automatically by deleting them and then trying to create a new password.
+
### Fixed
- Cancelling the Autofill "Generate password" action now correctly returns you to the original app.
diff --git a/app/src/main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt b/app/src/main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt
index 01d85f2b..94a32ea4 100644
--- a/app/src/main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt
@@ -335,10 +335,7 @@ class PasswordCreationActivity : BasePgpActivity(), OpenPgpServiceConnection.OnB
// pass enters the key ID into `.gpg-id`.
val repoRoot = PasswordRepository.getRepositoryDirectory()
val gpgIdentifierFile = File(repoRoot, directory.text.toString()).findTillRoot(".gpg-id", repoRoot)
- if (gpgIdentifierFile == null) {
- snackbar(message = resources.getString(R.string.failed_to_find_key_id))
- return@with
- }
+ ?: File(repoRoot, ".gpg-id").apply { createNewFile() }
val gpgIdentifiers = gpgIdentifierFile.readLines()
.filter { it.isNotBlank() }
.map { line ->
diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml
index cac0550d..b4e35467 100644
--- a/app/src/main/res/values-fr/strings.xml
+++ b/app/src/main/res/values-fr/strings.xml
@@ -264,7 +264,6 @@
<!-- Password creation failure -->
<string name="password_creation_file_fail_title">Erreur</string>
<string name="exporting_passwords">Exportation des mots de passe…</string>
- <string name="failed_to_find_key_id">Impossible de localiser .gpg-id, votre dépôt est-il correctement configuré ?</string>
<string name="short_key_ids_unsupported">Un ID de clé dans .gpg-id est trop court, veuillez utiliser soit des identifiants de clés longs (16 caractères) soit des empreintes digitales (40 caractères)</string>
<string name="directory_hint">Dossier</string>
<string name="new_folder_set_gpg_key">Définir la clé GPG pour le dossier</string>
diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml
index 284b1cf6..846a9993 100644
--- a/app/src/main/res/values-pt-rBR/strings.xml
+++ b/app/src/main/res/values-pt-rBR/strings.xml
@@ -299,7 +299,6 @@
<string name="otp_import_success">Configuração TOTP importada com sucesso</string>
<string name="otp_import_failure">Falha ao importar a configuração TOTP</string>
<string name="exporting_passwords">Exportando senhas…</string>
- <string name="failed_to_find_key_id">Falha ao localizar .gpg-id, seu store está configurado corretamente?</string>
<string name="invalid_gpg_id">Encontrado .gpg-id, mas contém uma ID de chave inválida, fingerprint ou ID de usuário</string>
<string name="short_key_ids_unsupported">O ID de chave em .gpg-id é muito curto, por favor utilize os IDs de chaves longos (16 caracteres) ou fingerprints (40 caracteres)</string>
<string name="invalid_filename_text">Nome do arquivo não deve conter \'/\', defina o diretório acima</string>
diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml
index 157023eb..3bf97f11 100644
--- a/app/src/main/res/values-ru/strings.xml
+++ b/app/src/main/res/values-ru/strings.xml
@@ -303,7 +303,6 @@
<string name="otp_import_success">Конфигурация TOTP успешно импортирована</string>
<string name="otp_import_failure">Не удалось импортировать конфигурацию TOTP</string>
<string name="exporting_passwords">Экспорт паролей…</string>
- <string name="failed_to_find_key_id">Не удалось найти .gpg-id, ваше хранилище настроено корректно?</string>
<string name="invalid_gpg_id">Найден .gpg-id, но он содержит неверный ID ключа, fingerprint или ID пользователя</string>
<string name="short_key_ids_unsupported">Идентификатор ключа в .gpg-id слишком короткий, пожалуйста, используйте длинные идентификаторы (16 символов) или fingerprint (40 символов)</string>
<string name="invalid_filename_text">Имя файла не должно содержать \'/\', укажите директорию выше</string>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 984b961c..6bfc1977 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -361,7 +361,6 @@
<string name="otp_import_success">Successfully imported TOTP configuration</string>
<string name="otp_import_failure">Failed to import TOTP configuration</string>
<string name="exporting_passwords">Exporting passwords…</string>
- <string name="failed_to_find_key_id">Failed to locate .gpg-id, is your store set up correctly?</string>
<string name="invalid_gpg_id">Found .gpg-id, but it contains an invalid key ID, fingerprint or user ID</string>
<string name="short_key_ids_unsupported">A key ID in .gpg-id is too short, please use either long key IDs (16 characters) or fingerprints (40 characters)</string>
<string name="invalid_filename_text">File name must not contain \'/\', set directory above</string>