diff options
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-rw-r--r-- | src/config.rs | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index a0510fd..43fbddd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ * `rbw generate` can now choose the same character more than once (#54, rjc) * Improved handling of password history for entries with no password (#51/#53, simias) +* Fix configuring base_url with a trailing slash when using a self-hosted + version of the official bitwarden server (#49, phylor) ## [1.1.2] - 2021-03-06 diff --git a/src/config.rs b/src/config.rs index dbdf759..c6e0787 100644 --- a/src/config.rs +++ b/src/config.rs @@ -126,7 +126,7 @@ impl Config { pub fn base_url(&self) -> String { self.base_url.clone().map_or_else( || "https://api.bitwarden.com".to_string(), - |url| format!("{}/api", url), + |url| format!("{}/api", url.trim_end_matches('/')), ) } @@ -134,7 +134,7 @@ impl Config { self.identity_url.clone().unwrap_or_else(|| { self.base_url.clone().map_or_else( || "https://identity.bitwarden.com".to_string(), - |url| format!("{}/identity", url), + |url| format!("{}/identity", url.trim_end_matches('/')), ) }) } |