fix: url path trailing slash for custom-providers (#4345)

Signed-off-by: developerayo <shodipovi@gmail.com>
This commit is contained in:
Shodipo Ayomide
2025-08-26 21:25:49 +01:00
committed by GitHub
parent 57f57b2a2d
commit 674acb4d02
+7 -1
View File
@@ -297,8 +297,14 @@ impl ApiClient {
fn build_url(&self, path: &str) -> Result<url::Url> {
use url::Url;
let base_url =
let mut base_url =
Url::parse(&self.host).map_err(|e| anyhow::anyhow!("Invalid base URL: {}", e))?;
let base_path = base_url.path();
if !base_path.is_empty() && base_path != "/" && !base_path.ends_with('/') {
base_url.set_path(&format!("{}/", base_path));
}
base_url
.join(path)
.map_err(|e| anyhow::anyhow!("Failed to construct URL: {}", e))