diff --git a/sshagent/trezor.py b/sshagent/trezor.py index a15c686..4bafab8 100644 --- a/sshagent/trezor.py +++ b/sshagent/trezor.py @@ -83,20 +83,15 @@ class Client(object): return (r, s) -def _split(s, *parts): - return re.match(regexp, s).groups() - - -_parts = [ +_identity_regexp = re.compile(''.join([ '^' r'(?:(?P.*)://)?', r'(?:(?P.*)@)?', r'(?P.*?)', r'(?::(?P\w*))?', - r'(?:/(?P.*))?', + r'(?P/.*)?', '$' -] -_identity_regexp = re.compile(''.join(_parts)) +])) def _string_to_identity(s): m = _identity_regexp.match(s) @@ -117,13 +112,14 @@ def _identity_to_string(identity): if identity.port: result.append(':' + identity.port) if identity.path: - result.append('/' + identity.path) + result.append(identity.path) return ''.join(result) def _get_address(identity): index = struct.pack('