7d64576ae8c2e788acaeb08437478a05aea875b1

Author
Andrii Kostenko <andrey@kostenko.name>
Committer
GitHub <noreply@github.com>
Date

Message

Support 644 and 640 permissions as well

Diff

 1diff --git a/autoswitch_virtualenv.plugin.zsh b/autoswitch_virtualenv.plugin.zsh
 2index 1927b4180abc2e0a4707c1dc4babc0962a282fa4..a78651cfafccff2be788bf58d31e9be47383ee2a 100644
 3--- a/autoswitch_virtualenv.plugin.zsh
 4+++ b/autoswitch_virtualenv.plugin.zsh
 5@@ -77,7 +77,7 @@ function check_venv()
 6             printf "AUTOSWITCH WARNING: Virtualenv will not be activated\n\n"
 7             printf "Reason: Found a .venv file but it is not owned by the current user\n"
 8             printf "Change ownership of $venv_path to '$USER' to fix this\n"
 9-          elif [[ "$file_permissions" != "600" ]]; then
10+          elif ! [[ "$file_permissions" =~ ^[64][04][04]$ ]]; then
11             printf "AUTOSWITCH WARNING: Virtualenv will not be activated\n\n"
12             printf "Reason: Found a .venv file with weak permission settings ($file_permissions).\n"
13             printf "Run the following command to fix this: \"chmod 600 $venv_path\"\n"