Skip to content

Commit c8c415f

Browse files
committed
pass: fix interpolation of $PASSWORD_STORE_DIR
commit a13ff50 simplified the handling of env-vars in getPassDir(), but moved interpolation of env-vars to the end of the function. As a result, a custom path passed through `$PASSWORD_STORE_DIR` would now be interpolated, instead of taken as-is. For example; PASSWORD_STORE_DIR=$PWD/world Would now interpolate `$PWD`, instead of using a literal `$PWD`. This patch changes the logic to only expand env-vars for the default location. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 2860ca4 commit c8c415f

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

pass/pass.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,10 @@ func (p Pass) Delete(serverURL string) error {
104104
}
105105

106106
func getPassDir() string {
107-
passDir := "$HOME/.password-store"
108-
if envDir := os.Getenv("PASSWORD_STORE_DIR"); envDir != "" {
109-
passDir = envDir
107+
if passDir := os.Getenv("PASSWORD_STORE_DIR"); passDir != "" {
108+
return passDir
110109
}
111-
return os.ExpandEnv(passDir)
110+
return os.ExpandEnv("$HOME/.password-store")
112111
}
113112

114113
// listPassDir lists all the contents of a directory in the password store.

0 commit comments

Comments
 (0)