mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
aquatic_peer_id: be stricter about letters in version numbers
Also fix failing test
This commit is contained in:
parent
00c4e61ed9
commit
08239dff1f
1 changed files with 2 additions and 2 deletions
|
|
@ -131,7 +131,7 @@ impl PeerClient {
|
||||||
|
|
||||||
if let Some(caps) = AZ_RE
|
if let Some(caps) = AZ_RE
|
||||||
.get_or_init(|| {
|
.get_or_init(|| {
|
||||||
Regex::new(r"^\-(?P<name>[a-zA-Z]{2})(?P<version>[0-9A-Z]{4})")
|
Regex::new(r"^\-(?P<name>[a-zA-Z]{2})(?P<version>[0-9]{3}[0-9AB])")
|
||||||
.expect("compile AZ_RE regex")
|
.expect("compile AZ_RE regex")
|
||||||
})
|
})
|
||||||
.captures(&peer_id.0)
|
.captures(&peer_id.0)
|
||||||
|
|
@ -226,7 +226,7 @@ mod tests {
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
PeerClient::from_peer_id(&create_peer_id(b"-UT123A-k/asdh3")),
|
PeerClient::from_peer_id(&create_peer_id(b"-UT123A-k/asdh3")),
|
||||||
PeerClient::UTorrent("1.2.3 [Alpha]".into())
|
PeerClient::UTorrent("1.2.3 alpha".into())
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
PeerClient::from_peer_id(&create_peer_id(b"-TR0012-k/asdh3")),
|
PeerClient::from_peer_id(&create_peer_id(b"-TR0012-k/asdh3")),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue