aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAyush Agarwal <ayush@fastmail.in>2021-11-15 09:30:52 +0530
committerAyush Agarwal <ayush@fastmail.in>2021-11-15 09:30:52 +0530
commita1b59dd6a949633a86b91dcc9bf23f896107182d (patch)
tree76d296b686bd11eaac5ca703789f86c372b6ef3b
parent8704837c8a4990b41aa9328ea1326b3e1afef4da (diff)
fix: exit if file is empty or decryption failsv1.2.2
-rw-r--r--README.md6
-rwxr-xr-xtessen8
2 files changed, 9 insertions, 5 deletions
diff --git a/README.md b/README.md
index 390cc74..0cce568 100644
--- a/README.md
+++ b/README.md
@@ -66,9 +66,9 @@ which you probably should.
### Stable Release
```
-wget https://github.com/ayushnix/tessen/releases/download/v1.2.1/tessen-1.2.1.tar.gz
-tar xvzf tessen-1.2.1.tar.gz
-cd tessen-1.2.1
+wget https://github.com/ayushnix/tessen/releases/download/v1.2.2/tessen-1.2.2.tar.gz
+tar xvzf tessen-1.2.2.tar.gz
+cd tessen-1.2.2
sudo make install
```
diff --git a/tessen b/tessen
index a22dfb1..8926e39 100755
--- a/tessen
+++ b/tessen
@@ -10,7 +10,7 @@ set +x
# GLOBAL VARIABLES
# variables which won't be changed and can be made readonly
-readonly tsn_version="1.2.1"
+readonly tsn_version="1.2.2"
readonly tsn_prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
readonly tsn_cliptime="${PASSWORD_STORE_CLIP_TIME:-15}"
readonly tsn_delay="${TESSEN_DELAY:-200}"
@@ -54,7 +54,11 @@ get_pass_data() {
local -a passdata
local keyval_regex otp_regex idx key val
- mapfile -t passdata < <(pass "$tsn_passfile")
+ mapfile -t passdata < <(pass "$tsn_passfile" 2> /dev/null)
+ if [[ "${#passdata[@]}" -eq 0 ]]; then
+ _die "$tsn_passfile is empty"
+ fi
+
# the key can contain
# alphanumerics, spaces, hyphen, underscore, plus, at, and hash
# the value can contain