mirror of
https://github.com/LemmyNet/activitypub-federation-rust.git
synced 2025-05-20 01:18:52 +00:00
Remove trailing . from domain
This commit is contained in:
parent
9413bad37a
commit
531d4264cd
2 changed files with 11 additions and 2 deletions
|
@ -46,7 +46,7 @@ async fn main() -> Result<(), Error> {
|
||||||
info!("Alpha user follows beta user via webfinger");
|
info!("Alpha user follows beta user via webfinger");
|
||||||
alpha
|
alpha
|
||||||
.local_user()
|
.local_user()
|
||||||
.follow("beta@localhost:8002", &alpha.to_request_data())
|
.follow("beta@localhost.:8002", &alpha.to_request_data())
|
||||||
.await?;
|
.await?;
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
beta.local_user().followers(),
|
beta.local_user().followers(),
|
||||||
|
|
|
@ -206,7 +206,16 @@ impl<T: Clone> FederationConfig<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.url_verifier.verify(url).await?;
|
// It is valid but uncommon for domains to end with `.` char. Drop this so it cant be used
|
||||||
|
// to bypass domain blocklist. Avoid cloning url in common case.
|
||||||
|
if domain.ends_with(".") {
|
||||||
|
let mut url = url.clone();
|
||||||
|
let domain = &domain[0..domain.len() - 1];
|
||||||
|
url.set_host(Some(domain))?;
|
||||||
|
self.url_verifier.verify(&url).await?;
|
||||||
|
} else {
|
||||||
|
self.url_verifier.verify(url).await?;
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue