From 90373f042e8ce679870c1868cb0957fb825d00d5 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 5 Feb 2016 01:12:18 +0100 Subject: Handle removal of directories and passwords with the same name --- src/password-store.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/password-store.sh b/src/password-store.sh index d535a74..8051451 100755 --- a/src/password-store.sh +++ b/src/password-store.sh @@ -490,11 +490,10 @@ cmd_delete() { local path="$1" check_sneaky_paths "$path" - local passfile="$PREFIX/${path%/}" - if [[ ! -d $passfile ]]; then - passfile="$PREFIX/$path.gpg" - [[ ! -f $passfile ]] && die "Error: $path is not in the password store." - fi + local passdir="$PREFIX/${path%/}" + local passfile="$PREFIX/$path.gpg" + [[ -f $passfile && -d $passdir && $path == */ || ! -f $passfile ]] && passfile="$passdir" + [[ ! -e $passfile ]] && die "Error: $path is not in the password store." [[ $force -eq 1 ]] || yesno "Are you sure you would like to delete $path?" -- cgit v1.2.3-59-g8ed1b