qute-pass: Also escape backslashes in the username

This commit is contained in:
cryzed 2018-04-20 18:23:50 +02:00
parent c2472d88f1
commit 2de6428830

View File

@ -150,6 +150,7 @@ def main(arguments):
stderr('Failed to match username pattern on {}!'.format(arguments.username_target)) stderr('Failed to match username pattern on {}!'.format(arguments.username_target))
return ExitCodes.COULD_NOT_MATCH_USERNAME return ExitCodes.COULD_NOT_MATCH_USERNAME
username = match.group(1) username = match.group(1)
username = username.replace('\\', '\\\\')
# Match password # Match password
match = re.match(arguments.password_pattern, secret) match = re.match(arguments.password_pattern, secret)
@ -157,8 +158,6 @@ def main(arguments):
stderr('Failed to match password pattern on secret!') stderr('Failed to match password pattern on secret!')
return ExitCodes.COULD_NOT_MATCH_PASSWORD return ExitCodes.COULD_NOT_MATCH_PASSWORD
password = match.group(1) password = match.group(1)
# Escape backslash so that they are inserted correctly
password = password.replace('\\', '\\\\') password = password.replace('\\', '\\\\')
insert_mode = ';; enter-mode insert' if arguments.insert_mode else '' insert_mode = ';; enter-mode insert' if arguments.insert_mode else ''