aboutsummaryrefslogtreecommitdiff
path: root/crypt.sh
diff options
context:
space:
mode:
authorFederico Angelilli <code@fedang.net>2024-01-02 17:56:59 +0100
committerFederico Angelilli <code@fedang.net>2024-01-02 17:56:59 +0100
commitccd6162e858c2969abef0532b6d3cfc449905488 (patch)
tree992546f4cc5e4bb8bcba0ae625b3bf03d8fd91b4 /crypt.sh
parente61ec910b92b14980e8ad78e5dc28f9246d155ad (diff)
Fix find_entry bug
Diffstat (limited to 'crypt.sh')
-rwxr-xr-xcrypt.sh9
1 files changed, 6 insertions, 3 deletions
diff --git a/crypt.sh b/crypt.sh
index f330c0f..373fe37 100755
--- a/crypt.sh
+++ b/crypt.sh
@@ -266,6 +266,7 @@ entries_show+=( "none" )
entries_edit+=( "none" )
entries_color+=( "blue,bold" )
+# TODO: Consider hiding these
# Signature entry
entries_ext+=( "" )
entries_name+=( "signature" )
@@ -330,7 +331,7 @@ find_entry() {
entry=2
elif [[ "$path" == *.sig ]]; then
entry=3
- elif [[ -f "$path" && "$path" != *.gpg ]]; then
+ elif [[ -f "$CRYPT_PATH/$path" && "$path" != *.gpg ]]; then
entry=1
else
for ((i = 4; i < ${#entries_ext[@]}; i++)); do
@@ -351,7 +352,9 @@ check_file() {
local matches=()
for ((i = 4; i < ${#entries_name[@]}; i++)); do
[[ "$path" == *.${entries_ext[$i]} ]] && echo "$path" && return
- [[ -f "$CRYPT_PATH/$path.${entries_ext[$i]}.gpg" ]] && matches+=( "$path.${entries_ext[$i]}" )
+ if [[ -f "$CRYPT_PATH/$path.${entries_ext[$i]}.gpg" ]]; then
+ matches+=( "$path.${entries_ext[$i]}" )
+ fi
done
case ${#matches[@]} in
@@ -440,7 +443,7 @@ cmd_init() {
_cmd_action_file() {
[[ $CLOSED -eq 1 ]] && error "The crypt must be open to $2 a file."
- local path="$1" file="$CRYPT_PATH/$path"
+ local path="$1" file="$CRYPT_PATH/${path%.gpg}.gpg"
git_prep "$file"
[[ -d $file ]] && error "The given path is a directory."