Skip to content

Commit

Permalink
Update src/parse.rs
Browse files Browse the repository at this point in the history
Co-authored-by: Joshua Nelson <[email protected]>
  • Loading branch information
zregvart and Joshua Nelson authored Nov 6, 2020
1 parent 3e73a72 commit e5be794
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ fn parse_a_hrefs(handle: &Handle, base_url: &Url, urls: &mut HashSet<Url>) {
.find(|attr| &attr.name.local == "href")
{
let mut val = attr.value.clone();
// if the href value starts with / we need to join it to the base without the /
// otherwise with base_url = `foo`, val = `/bar`, base_url.join(val) == `/bar`
// and not `foo/bar`
// Treat absolute paths as absolute with respect to the `base_url`, not with respect to the file system.
if attr.value.starts_with('/') {
val.pop_front_char();
}
Expand Down

0 comments on commit e5be794

Please sign in to comment.