0
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-09-19 04:01:21 +02:00

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

This commit is contained in:
Marc Cornellà 2022-01-19 19:27:53 +01:00
parent 0b08b70b0c
commit a7efd96a60
No known key found for this signature in database
GPG key ID: 0314585E776A9C1B

View file

@ -23,12 +23,12 @@ source_env() {
touch "$ZSH_DOTENV_DISALLOWED_LIST"
# early return if disallowed
if command grep -q "$dirpath" "$ZSH_DOTENV_DISALLOWED_LIST" &>/dev/null; then
if command grep -Fx -q "$dirpath" "$ZSH_DOTENV_DISALLOWED_LIST" &>/dev/null; then
return
fi
# check if current directory's .env file is allowed or ask for confirmation
if ! command grep -q "$dirpath" "$ZSH_DOTENV_ALLOWED_LIST" &>/dev/null; then
if ! command grep -Fx -q "$dirpath" "$ZSH_DOTENV_ALLOWED_LIST" &>/dev/null; then
# get cursor column and print new line before prompt if not at line beginning
local column
echo -ne "\e[6n" > /dev/tty