From c02ad427be3652298f4a07a5f1a0d68e4ac44c45 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Thu, 10 Dec 2020 21:06:45 +0530 Subject: [PATCH] Try to fix missing `.gpg-id` files as well (#1246) --- CHANGELOG.md | 1 + .../dev/msfjarvis/aps/ui/crypto/PasswordCreationActivity.kt | 5 +---- app/src/main/res/values-fr/strings.xml | 1 - app/src/main/res/values-pt-rBR/strings.xml | 1 - app/src/main/res/values-ru/strings.xml | 1 - app/src/main/res/values/strings.xml | 1 - 6 files changed, 2 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30efefa7..3816a06a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. ### Added - On Android 11, Autofill will use the new [inline autofill](https://developer.android.com/guide/topics/text/ime-autofill#configure-provider) UI that integrates Autofill results into your keyboard app. +- Invalid `.gpg-id` files can now be fixed automatically by deleting them and then trying to create a new password. ### Fixed diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivity.kt b/app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivity.kt index 403f6e2a..2ddcc8b8 100644 --- a/app/src/main/java/dev/msfjarvis/aps/ui/crypto/PasswordCreationActivity.kt +++ b/app/src/main/java/dev/msfjarvis/aps/ui/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 10fa1130..cc4f6995 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -245,7 +245,6 @@ Erreur Exportation des mots de passe… - Impossible de localiser .gpg-id, votre dépôt est-il correctement configuré ? 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) Dossier Définir la clé GPG pour le dossier diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index c45b2705..40b99b39 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -279,7 +279,6 @@ Configuração TOTP importada com sucesso Falha ao importar a configuração TOTP Exportando senhas… - Falha ao localizar .gpg-id, seu store está configurado corretamente? Encontrado .gpg-id, mas contém uma ID de chave inválida, fingerprint ou ID de usuário O ID de chave em .gpg-id é muito curto, por favor utilize os IDs de chaves longos (16 caracteres) ou fingerprints (40 caracteres) Nome do arquivo não deve conter \'/\', defina o diretório acima diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index baa49c74..d1f046ee 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -283,7 +283,6 @@ Конфигурация TOTP успешно импортирована Не удалось импортировать конфигурацию TOTP Экспорт паролей… - Не удалось найти .gpg-id, ваше хранилище настроено корректно? Найден .gpg-id, но он содержит неверный ID ключа, fingerprint или ID пользователя Идентификатор ключа в .gpg-id слишком короткий, пожалуйста, используйте длинные идентификаторы (16 символов) или fingerprint (40 символов) Имя файла не должно содержать \'/\', укажите директорию выше diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6ffadb9e..03a1689e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -344,7 +344,6 @@ Successfully imported TOTP configuration Failed to import TOTP configuration Exporting passwords… - Failed to locate .gpg-id, is your store set up correctly? Found .gpg-id, but it contains an invalid key ID, fingerprint or user ID A key ID in .gpg-id is too short, please use either long key IDs (16 characters) or fingerprints (40 characters) File name must not contain \'/\', set directory above