Add support for per-domain secret files in qute-pass
This adds support for password stores where the domain is not the directory name, but the filename of a gpg file. This solves problems when using a password store folder structure like this reddit user does: https://www.reddit.com/r/qutebrowser/comments/7owzl2/cant_get_qutepass_working/
This commit is contained in:
parent
1f86f9814b
commit
4166e50764
@ -97,13 +97,19 @@ def qute_command(command):
|
|||||||
def find_pass_candidates(domain, password_store_path):
|
def find_pass_candidates(domain, password_store_path):
|
||||||
candidates = []
|
candidates = []
|
||||||
for path, directories, file_names in os.walk(password_store_path, followlinks=True):
|
for path, directories, file_names in os.walk(password_store_path, followlinks=True):
|
||||||
if directories or domain not in path.split(os.path.sep):
|
secrets = fnmatch.filter(file_names, '*.gpg')
|
||||||
|
if not secrets:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Strip password store path prefix to get the relative pass path
|
# 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) + 1:]
|
||||||
secrets = fnmatch.filter(file_names, '*.gpg')
|
split_path = pass_path.split(os.path.sep)
|
||||||
candidates.extend(os.path.join(pass_path, os.path.splitext(secret)[0]) for secret in secrets)
|
for secret in secrets:
|
||||||
|
secret_base = os.path.splitext(secret)[0]
|
||||||
|
if domain not in (split_path + [secret_base]):
|
||||||
|
continue
|
||||||
|
|
||||||
|
candidates.append(os.path.join(pass_path, secret_base))
|
||||||
return candidates
|
return candidates
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user