diff options
| author | Oliver Middleton <olliemail27@gmail.com> | 2017-01-20 08:36:09 +0000 |
|---|---|---|
| committer | Oliver Middleton <olliemail27@gmail.com> | 2017-01-20 08:36:09 +0000 |
| commit | 543eca2eab970a7d8f460fcde30098d2edbc2b5e (patch) | |
| tree | f7828d24215a89cd690760a779eff37cf028888d /src/tools/linkchecker | |
| parent | b53d37479079d820290e21c424f0a6f9af112afe (diff) | |
| download | rust-543eca2eab970a7d8f460fcde30098d2edbc2b5e.tar.gz rust-543eca2eab970a7d8f460fcde30098d2edbc2b5e.zip | |
linkchecker: Fix checking links which are just fragments
Also fix a typo which linkchecker should have caught.
Diffstat (limited to 'src/tools/linkchecker')
| -rw-r--r-- | src/tools/linkchecker/main.rs | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/tools/linkchecker/main.rs b/src/tools/linkchecker/main.rs index 0e70c2b432f..f84d685127b 100644 --- a/src/tools/linkchecker/main.rs +++ b/src/tools/linkchecker/main.rs @@ -151,9 +151,6 @@ fn check(cache: &mut Cache, } let mut parts = url.splitn(2, "#"); let url = parts.next().unwrap(); - if url.is_empty() { - return - } let fragment = parts.next(); let mut parts = url.splitn(2, "?"); let url = parts.next().unwrap(); @@ -161,14 +158,16 @@ fn check(cache: &mut Cache, // Once we've plucked out the URL, parse it using our base url and // then try to extract a file path. let mut path = file.to_path_buf(); - path.pop(); - for part in Path::new(url).components() { - match part { - Component::Prefix(_) | - Component::RootDir => panic!(), - Component::CurDir => {} - Component::ParentDir => { path.pop(); } - Component::Normal(s) => { path.push(s); } + if !url.is_empty() { + path.pop(); + for part in Path::new(url).components() { + match part { + Component::Prefix(_) | + Component::RootDir => panic!(), + Component::CurDir => {} + Component::ParentDir => { path.pop(); } + Component::Normal(s) => { path.push(s); } + } } } |
