From b1e2a1ec2da7d56cad3e304b1a697aee9e7614d2 Mon Sep 17 00:00:00 2001 From: wildente Date: Sun, 9 Sep 2018 22:16:48 +0200 Subject: [PATCH] add proper multiline support for qute-pass when using the 'username-taget secret' option, the supplied regex 'username-pattern' will only scan the first line of the secret file. you could specify a username-pattern with '\n', but this will break if the position of the username is not consistent. this change will implement re.search and the re.MULTILINE option to search every line in a secrect file. example: --secret file my_secret_password username: my_username --secret file spawn --userscript qute-pass --username-target secret --username-pattern "^username: (.*)" --- misc/userscripts/qute-pass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/userscripts/qute-pass b/misc/userscripts/qute-pass index 4f79e1115..ca9c4d4ca 100755 --- a/misc/userscripts/qute-pass +++ b/misc/userscripts/qute-pass @@ -169,7 +169,7 @@ def main(arguments): # Match username target = selection if arguments.username_target == 'path' else secret - match = re.match(arguments.username_pattern, target) + match = re.search(arguments.username_pattern, target, re.MULTILINE) if not match: stderr('Failed to match username pattern on {}!'.format(arguments.username_target)) return ExitCodes.COULD_NOT_MATCH_USERNAME