Fixed goofy ahh way to remove a slash from the end of the url

This commit is contained in:
bitfl0wer 2023-04-15 13:03:51 +02:00
parent 9855efe15e
commit d60711a5d1
No known key found for this signature in database
GPG Key ID: 84BBB60DF895ABF2
1 changed files with 6 additions and 1 deletions

View File

@ -46,7 +46,12 @@ impl URLBundle {
} }
Err(_) => panic!("Invalid URL"), Err(_) => panic!("Invalid URL"),
}; };
url.to_string()[0..url.to_string().len() - 1].to_string() // Remove '/' at the end of the URL // if the last character of the string is a slash, remove it.
let mut url_string = url.to_string();
if url_string.chars().last().unwrap() == '/' {
url_string.pop();
}
return url_string;
} }
pub fn get_api(&self) -> &str { pub fn get_api(&self) -> &str {