The _userinfo_host_port_rx will always match when auth isn't empty,
and we've already handled the empty case. If it doesn't, something's
wrong, so assert.
Signed-off-by: Rob Browning <
r...@defaultvalue.org>
Tested-by: Rob Browning <
r...@defaultvalue.org>
---
lib/bup/url.py | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/lib/bup/url.py b/lib/bup/url.py
index 152dc7f7..71188aba 100644
--- a/lib/bup/url.py
+++ b/lib/bup/url.py
@@ -132,14 +132,12 @@ def parse_bytes_path_url(url, require_auth=False):
if not auth: # Use a subprocess for testing
return URL(scheme=scheme, path=path)
m = _userinfo_host_port_rx.fullmatch(auth)
- if not m:
- user, host, port = b'', auth, None
- else:
- user, host, port = m.groups(b'')
- # drop the password immediately (RFC concurs)
- user, colon_, passwd_ = user.partition(b':')
- user = unquote_to_bytes(user)
- port = int(port) if port else None
+ assert m, url # we know auth is not empty, and rx has .*
+ user, host, port = m.groups(b'')
+ # drop the password immediately (RFC concurs)
+ user, colon_, passwd_ = user.partition(b':')
+ user = unquote_to_bytes(user)
+ port = int(port) if port else None
# REVIEW: is ip_address exactly right for this?
if host and host[0] == b'['[0] and host[-1] == b']'[0]:
addr = parse_addr(host[1:-1])
--
2.47.3