mirror of
https://github.com/agersant/polaris
synced 2024-11-10 10:14:12 +00:00
Fix commented issues.
This commit is contained in:
parent
f04e1bc4d7
commit
b348be4e10
2 changed files with 2 additions and 4 deletions
|
@ -82,7 +82,7 @@ pub fn get_api_handler(collection: Arc<Collection>) -> Mount {
|
|||
}
|
||||
|
||||
fn path_from_request(request: &Request) -> Result<PathBuf> {
|
||||
let path_string = request.url.path().join("/");
|
||||
let path_string = request.url.path().join(&::std::path::MAIN_SEPARATOR.to_string());
|
||||
let decoded_path = percent_decode(path_string.as_bytes()).decode_utf8()?;
|
||||
Ok(PathBuf::from(decoded_path.deref()))
|
||||
}
|
||||
|
|
|
@ -193,12 +193,10 @@ impl Config {
|
|||
|
||||
fn clean_path_string(path_string: &str) -> path::PathBuf {
|
||||
let separator_regex = regex::Regex::new(r"\\|/").unwrap();
|
||||
let trailing_regex = regex::Regex::new(r"(/)+$").unwrap();
|
||||
let mut correct_separator = String::new();
|
||||
correct_separator.push(path::MAIN_SEPARATOR);
|
||||
let path_string = separator_regex.replace_all(path_string, correct_separator.as_str());
|
||||
let path_string = trailing_regex.replace_all(&path_string, "");
|
||||
path::PathBuf::from(path_string)
|
||||
path::Path::new(&path_string).iter().collect()
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Reference in a new issue