aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2021-04-18 00:08:46 -0400
committerJesse Luehrs <doy@tozt.net>2021-04-18 00:08:46 -0400
commit95c29fd68cda5748d4e1cb3f02c5c7a0b202454b (patch)
tree29129d76a45d91dfedb24c90c161388e80739713
parent6e8c700bccd5b3a5540f4ae303758858eeb40829 (diff)
downloadrbw-95c29fd68cda5748d4e1cb3f02c5c7a0b202454b.tar.gz
rbw-95c29fd68cda5748d4e1cb3f02c5c7a0b202454b.zip
avoid generating urls with double slashes
apparently the official bitwarden server doesn't like it
-rw-r--r--CHANGELOG.md2
-rw-r--r--src/config.rs4
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('/')),
)
})
}