From d60711a5d13e118de84830dca64cb9555797e703 Mon Sep 17 00:00:00 2001 From: bitfl0wer Date: Sat, 15 Apr 2023 13:03:51 +0200 Subject: [PATCH] Fixed goofy ahh way to remove a slash from the end of the url --- src/lib.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index ead17f1..2717c81 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -46,7 +46,12 @@ impl URLBundle { } 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 {