mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
auto merge of #2407 : Ms2ger/servo/try_parse_url-owned, r=jdm
This commit is contained in:
commit
3bb81310d4
1 changed files with 3 additions and 3 deletions
|
@ -18,7 +18,7 @@ Create a URL object from a string. Does various helpful browsery things like
|
|||
*/
|
||||
// TODO: about:failure->
|
||||
pub fn try_parse_url(str_url: &str, base_url: Option<std_url::Url>) -> Result<std_url::Url, ~str> {
|
||||
let str_url = str_url.trim_chars(& &[' ', '\t', '\n', '\r', '\x0C']).to_owned();
|
||||
let str_url = str_url.trim_chars(& &[' ', '\t', '\n', '\r', '\x0C']);
|
||||
let schm = std_url::get_scheme(str_url);
|
||||
let str_url = match schm {
|
||||
Err(_) => {
|
||||
|
@ -69,7 +69,7 @@ pub fn try_parse_url(str_url: &str, base_url: Option<std_url::Url>) -> Result<st
|
|||
"file://".to_owned() + path.display().to_str()
|
||||
}
|
||||
// TODO: handle the rest of the about: pages
|
||||
_ => str_url
|
||||
_ => str_url.to_owned()
|
||||
}
|
||||
},
|
||||
"data" => {
|
||||
|
@ -78,7 +78,7 @@ pub fn try_parse_url(str_url: &str, base_url: Option<std_url::Url>) -> Result<st
|
|||
// %-encoded or base64'd.
|
||||
str_url.chars().filter(|&c| !c.is_whitespace()).collect()
|
||||
},
|
||||
_ => str_url
|
||||
_ => str_url.to_owned()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue