From 9a3425eabec6bf41559ce03b4e22324434a0f030 Mon Sep 17 00:00:00 2001 From: realaravinth Date: Thu, 14 Jul 2022 23:47:37 +0530 Subject: [PATCH] fix & chore: handle hostname/URL cleaning within trait implementation SUMMARY Renamed function parameters from "hostname" to "url" wherever a url::Url is received db_core::get_hostname is renamed to db_core::clean_url, better describing its new implementation forge_core::get_hostname is renamed to forge_core::get_url to better describe its new implementation URL PROCESSING METHODS federate/federate-core Parses URL and returns only the hostname db/db-core Parses URL, cleans it by removing path and query parameters and returns the end result --- db/db-core/src/lib.rs | 2 +- federate/publiccodeyml/src/lib.rs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/db/db-core/src/lib.rs b/db/db-core/src/lib.rs index 10d0b2f..2603f10 100644 --- a/db/db-core/src/lib.rs +++ b/db/db-core/src/lib.rs @@ -210,7 +210,7 @@ pub trait SCDatabase: std::marker::Send + std::marker::Sync + CloneSPDatabase { /// get user data async fn get_user(&self, username: &str, url: &Url) -> DBResult; - /// check if an user exists. When url of a forge instace is provided, username search is + /// check if an user exists. When url of a forge instance is provided, username search is /// done only on that forge async fn user_exists(&self, username: &str, url: Option<&Url>) -> DBResult; diff --git a/federate/publiccodeyml/src/lib.rs b/federate/publiccodeyml/src/lib.rs index ca02e19..573d3c6 100644 --- a/federate/publiccodeyml/src/lib.rs +++ b/federate/publiccodeyml/src/lib.rs @@ -161,7 +161,6 @@ impl Federate for PccFederate { Ok(false) } } - /// create user instance async fn create_user(&self, f: &AddUser<'_>) -> Result<(), Self::Error> { let path = self.get_user_path(f.username, &f.url, true).await?;