fix: escape path-prefix/url-prefix different

This commit is contained in:
sigoden
2022-06-06 08:00:26 +08:00
parent ce154d9ebc
commit b0cc901416
3 changed files with 11 additions and 11 deletions

View File

@@ -143,7 +143,7 @@ impl Args {
let uri_prefix = if path_prefix.is_empty() {
"/".to_owned()
} else {
format!("/{}/", encode_uri(&path_prefix))
format!("/{}/", &path_prefix)
};
let cors = matches.is_present("cors");
let auth = match matches.value_of("auth") {
@@ -237,8 +237,3 @@ pub fn load_private_key(filename: &str) -> BoxResult<PrivateKey> {
}
Ok(PrivateKey(keys[0].to_owned()))
}
pub fn encode_uri(v: &str) -> String {
let parts: Vec<_> = v.split('/').map(urlencoding::encode).collect();
parts.join("/")
}