update remove_endpoint_http_or_s

This commit is contained in:
2020-04-04 01:40:49 +08:00
parent 831d66fddb
commit ee2156a2ca

View File

@@ -103,10 +103,10 @@ impl OSSClient {
// https://endpoint, or http://endpoint -> endpoint
fn remove_endpoint_http_or_s(endpoint: &str) -> String {
let mut endpoint = endpoint.to_owned();
if endpoint.starts_with("http://") {
endpoint = endpoint.chars().skip("http://".chars().count()).collect::<String>();
} else if endpoint.starts_with("https://") {
endpoint = endpoint.chars().skip("https://".chars().count()).collect::<String>();
for prefix in vec!["http://", "https://"] {
if endpoint.starts_with(prefix) {
endpoint = endpoint.chars().skip(prefix.chars().count()).collect::<String>()
}
}
endpoint
}