fix: url path trailing slash for custom-providers (#4345)
Signed-off-by: developerayo <shodipovi@gmail.com>
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user