a7efd96a60157965370e1dbc4c7fce66b7a64225

Author
Marc Cornellà <hello@mcornella.com>
Committer
Marc Cornellà <hello@mcornella.com>
Date

Message

fix(dotenv): match for exact directory path in allowed/disallowed files

Diff

 1diff --git a/plugins/dotenv/dotenv.plugin.zsh b/plugins/dotenv/dotenv.plugin.zsh
 2index 40ec5c46fdbff5c54a7717a19aa1910494902b54..394455ae1c44a2db98fe42871c6f4e7e09ab3984 100644
 3--- a/plugins/dotenv/dotenv.plugin.zsh
 4+++ b/plugins/dotenv/dotenv.plugin.zsh
 5@@ -23,12 +23,12 @@ source_env() {
 6     touch "$ZSH_DOTENV_DISALLOWED_LIST"
 7 
 8     # early return if disallowed
 9-    if command grep -q "$dirpath" "$ZSH_DOTENV_DISALLOWED_LIST" &>/dev/null; then
10+    if command grep -Fx -q "$dirpath" "$ZSH_DOTENV_DISALLOWED_LIST" &>/dev/null; then
11       return
12     fi
13 
14     # check if current directory's .env file is allowed or ask for confirmation
15-    if ! command grep -q "$dirpath" "$ZSH_DOTENV_ALLOWED_LIST" &>/dev/null; then
16+    if ! command grep -Fx -q "$dirpath" "$ZSH_DOTENV_ALLOWED_LIST" &>/dev/null; then
17       # get cursor column and print new line before prompt if not at line beginning
18       local column
19       echo -ne "\e[6n" > /dev/tty