strip trailing / from token min url

This commit is contained in:
thesimplekid
2023-09-17 20:44:30 +01:00
parent 1f77966384
commit a9aa71fa25
2 changed files with 1 additions and 6 deletions

View File

@@ -122,11 +122,6 @@ pub struct Client {
impl Client {
pub fn new(mint_url: &str) -> Result<Self, Error> {
// HACK
let mut mint_url = String::from(mint_url);
if !mint_url.ends_with('/') {
mint_url.push('/');
}
let mint_url = Url::parse(&mint_url)?;
Ok(Self { mint_url })
}

View File

@@ -85,7 +85,7 @@ impl TryFrom<&UncheckedUrl> for Url {
impl fmt::Display for UncheckedUrl {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.0)
write!(f, "{}", self.0.strip_suffix("/").unwrap_or(&self.0))
}
}