1
0
Fork 0
forked from alemi/upub

fix: strip acct: from webfinger if given

This commit is contained in:
əlemi 2024-03-22 01:22:03 +01:00
parent 69f0239764
commit 5eec008343
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -95,7 +95,11 @@ impl<T: serde::Serialize> IntoResponse for JsonRD<T> {
}
pub async fn webfinger(State(ctx): State<Context>, Query(query): Query<WebfingerQuery>) -> Result<JsonRD<JsonResourceDescriptor>, StatusCode> {
if let Some((user, domain)) = query.resource.split_once('@') {
if let Some((user, domain)) = query
.resource
.replace("acct:", "")
.split_once('@')
{
let uid = ctx.uid(user.to_string());
match model::user::Entity::find_by_id(uid)
.one(ctx.db())