mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Merge pull request #362 from bdaehlie/servo361
Fix 'make_url' to handle absolute paths properly, allows servo command l...
This commit is contained in:
commit
375149b833
1 changed files with 7 additions and 3 deletions
|
@ -20,9 +20,13 @@ pub fn make_url(str_url: ~str, current_url: Option<Url>) -> Url {
|
|||
let mut schm = url::get_scheme(str_url);
|
||||
let str_url = if result::is_err(&schm) {
|
||||
if current_url.is_none() {
|
||||
// If all we have is a filename, assume it's a local relative file
|
||||
// and build an absolute path with the cwd
|
||||
~"file://" + os::getcwd().push(str_url).to_str()
|
||||
// Assume we've been given a file path. If it's absolute just return
|
||||
// it, otherwise make it absolute with the cwd.
|
||||
if str_url.starts_with("/") {
|
||||
~"file://" + str_url
|
||||
} else {
|
||||
~"file://" + os::getcwd().push(str_url).to_str()
|
||||
}
|
||||
} else {
|
||||
let current_url = current_url.get();
|
||||
debug!("make_url: current_url: %?", current_url);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue