Refactored prefix stripping to make clippy happy

This commit is contained in:
CEbbinghaus 2025-02-10 00:04:13 +11:00
parent ecff7bb92c
commit de38b4e72e
2 changed files with 5 additions and 9 deletions
server/core/src

View file

@ -1517,12 +1517,12 @@ impl QueryServerReadV1 {
)]
pub async fn handle_oauth2_webfinger_discovery(
&self,
client_id: String,
resource_id: String,
client_id: &str,
resource_id: &str,
eventid: Uuid,
) -> Result<OidcWebfingerResponse, OperationError> {
let mut idms_prox_read = self.idms.proxy_read().await?;
idms_prox_read.oauth2_openid_webfinger(&client_id, &resource_id)
idms_prox_read.oauth2_openid_webfinger(client_id, resource_id)
}
#[instrument(

View file

@ -554,15 +554,11 @@ pub async fn oauth2_openid_webfinger_get(
) -> impl IntoResponse {
let Oauth2OpenIdWebfingerQuery { resource } = query;
let cleaned_resource = if resource.starts_with("acct:") {
resource[5..].to_string()
} else {
resource.clone()
};
let cleaned_resource = resource.strip_prefix("acct:").unwrap_or(&resource);
let res = state
.qe_r_ref
.handle_oauth2_webfinger_discovery(client_id, cleaned_resource, kopid.eventid)
.handle_oauth2_webfinger_discovery(&client_id, cleaned_resource, kopid.eventid)
.await;
match res {