From 4d92fc6f77f8d7b0cc9c2acd527fa50b58a8b216 Mon Sep 17 00:00:00 2001 From: Abdel Benamrouche Date: Sun, 19 Jan 2020 00:29:45 +0100 Subject: [PATCH] Fix PASSWORD_STORE_DIR suffix Currently qute-pass works only if PASSWORD_STORE_DIR is not ending by slash character (on unix). find_pass_candidates compute pass_path = path[len(password_store_path)+1:] where +1 is used to count an extra slash. So if PASSWORD_STORE_DIR ends by slash we count it twice, leading to failure. Signed-off-by: Abdel Benamrouche --- misc/userscripts/qute-pass | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/misc/userscripts/qute-pass b/misc/userscripts/qute-pass index a22cd7187..fbaa3c285 100755 --- a/misc/userscripts/qute-pass +++ b/misc/userscripts/qute-pass @@ -105,7 +105,7 @@ def find_pass_candidates(domain, password_store_path): continue # Strip password store path prefix to get the relative pass path - pass_path = path[len(password_store_path) + 1:] + pass_path = path[len(password_store_path):] split_path = pass_path.split(os.path.sep) for secret in secrets: secret_base = os.path.splitext(secret)[0] @@ -152,6 +152,8 @@ def main(arguments): # Expand potential ~ in paths, since this script won't be called from a shell that does it for us password_store_path = os.path.expanduser(arguments.password_store) + # Add trailing slash if not present + password_store_path = os.path.join(password_store_path, '') # Try to find candidates using targets in the following order: fully-qualified domain name (includes subdomains), # the registered domain name, the IPv4 address if that's what the URL represents and finally the private domain