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 // https://endpoint, or http://endpoint -> endpoint
fn remove_endpoint_http_or_s(endpoint: &str) -> String { fn remove_endpoint_http_or_s(endpoint: &str) -> String {
let mut endpoint = endpoint.to_owned(); let mut endpoint = endpoint.to_owned();
if endpoint.starts_with("http://") { for prefix in vec!["http://", "https://"] {
endpoint = endpoint.chars().skip("http://".chars().count()).collect::<String>(); if endpoint.starts_with(prefix) {
} else if endpoint.starts_with("https://") { endpoint = endpoint.chars().skip(prefix.chars().count()).collect::<String>()
endpoint = endpoint.chars().skip("https://".chars().count()).collect::<String>(); }
} }
endpoint endpoint
} }