summaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorFabian Henneke <FabianHenneke@users.noreply.github.com>2020-08-14 09:57:16 +0200
committerGitHub <noreply@github.com>2020-08-14 13:27:16 +0530
commit087ab547c123e90eb4207bfe9080486d54fbf3ef (patch)
tree78b131dcb059a691c81efbe72fcf68e3f65f470b /app/src/main
parent57f1c65fdfbac9acd5e4fce30a6d5ef131fa9728 (diff)
Reland symlink support (#1020)
* Add symlink support to JGit (#1016) * Add symlink support to JGit * Fix a typo Co-authored-by: Harsh Shandilya <me@msfjarvis.dev> * Prevent crash when following a broken symlink Co-authored-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/crypto/DecryptActivity.kt10
-rw-r--r--app/src/main/res/values/strings.xml1
2 files changed, 10 insertions, 1 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/crypto/DecryptActivity.kt b/app/src/main/java/com/zeapo/pwdstore/crypto/DecryptActivity.kt
index 79f9e6da..a697f2ba 100644
--- a/app/src/main/java/com/zeapo/pwdstore/crypto/DecryptActivity.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/crypto/DecryptActivity.kt
@@ -12,6 +12,7 @@ import android.text.method.PasswordTransformationMethod
import android.view.Menu
import android.view.MenuItem
import android.view.View
+import android.widget.Toast
import androidx.activity.result.IntentSenderRequest
import androidx.activity.result.contract.ActivityResultContracts.StartIntentSenderForResult
import androidx.lifecycle.lifecycleScope
@@ -23,6 +24,7 @@ import com.zeapo.pwdstore.utils.PreferenceKeys
import com.zeapo.pwdstore.utils.viewBinding
import java.io.ByteArrayOutputStream
import java.io.File
+import java.io.FileNotFoundException
import kotlin.time.ExperimentalTime
import kotlin.time.seconds
import kotlinx.coroutines.Dispatchers
@@ -135,7 +137,13 @@ class DecryptActivity : BasePgpActivity(), OpenPgpServiceConnection.OnBound {
val data = receivedIntent ?: Intent()
data.action = OpenPgpApi.ACTION_DECRYPT_VERIFY
- val inputStream = File(fullPath).inputStream()
+ val inputStream = try {
+ File(fullPath).inputStream()
+ } catch (e: FileNotFoundException) {
+ Toast.makeText(this, getString(R.string.error_broken_symlink), Toast.LENGTH_SHORT).show()
+ finish()
+ return
+ }
val outputStream = ByteArrayOutputStream()
lifecycleScope.launch(Dispatchers.IO) {
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index df57f84e..98b4a0fd 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -224,6 +224,7 @@
<string name="no_repo_selected">No external repository selected</string>
<string name="send_plaintext_password_to">Send password as plaintext using…</string>
<string name="app_icon_hint">App icon</string>
+ <string name="error_broken_symlink">File not found, likely because of a broken symlink</string>
<!-- Oreo Autofill -->
<string name="oreo_autofill_strict_domain_search">Phishing-resistant search</string>