diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-02-05 01:12:18 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-02-05 01:14:44 +0100 |
commit | 90373f042e8ce679870c1868cb0957fb825d00d5 (patch) | |
tree | ff8c6c64697bde059499920bd4ea0d4b7d37716e /src | |
parent | bffca1ee21a38f1e808fa83e5df2fcf0f808cb9f (diff) |
Handle removal of directories and passwords with the same name
Diffstat (limited to 'src')
-rwxr-xr-x | src/password-store.sh | 9 |
1 files changed, 4 insertions, 5 deletions
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?" |