Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: handle absolute paths #91

Merged

Conversation

zregvart
Copy link
Contributor

@zregvart zregvart commented Nov 6, 2020

Some href values might start with a /, denoting an absolute path and
should be considered relative to the given dir path. In url::Url
join-ing absolute path results in that absolute path, i.e.:

assert!(base.join(Url::from_file_path("/page.html").unwrap()) == "/page.html")

In this case deadlinks would flag /page.html to be broken, whereas it
could be considered valid relative to the base path.

Copy link
Contributor

@jyn514 jyn514 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a note about this to the changelog?

src/parse.rs Outdated Show resolved Hide resolved
@zregvart zregvart force-pushed the pr/consider-absolute-relative-to-dir branch from e5be794 to ac64139 Compare November 6, 2020 18:20
@zregvart
Copy link
Contributor Author

zregvart commented Nov 6, 2020

Thanks for the suggestion @jyn514, I've incorporated it and added one line to the changelog.

CHANGELOG.md Outdated Show resolved Hide resolved
Some `href` values might start with a `/`, denoting an absolute path and
should be considered relative to the given `dir` path. In `url::Url`
`join`-ing absolute path results in that absolute path, i.e.:

```
assert!(base.join(Url::from_file_path("/page.html").unwrap()) == "/page.html")
```

In this case deadlinks would flag `/page.html` to be broken, whereas it
could be considered valid relative to the `base` path.

Co-authored-by: Joshua Nelson <[email protected]>
@zregvart zregvart force-pushed the pr/consider-absolute-relative-to-dir branch from ac64139 to 0bfc5fe Compare November 7, 2020 14:47
@zregvart
Copy link
Contributor Author

zregvart commented Nov 7, 2020

Fixed the changelog and rebased.

@jyn514 jyn514 merged commit 8c8da9f into deadlinks:master Nov 7, 2020
@jyn514
Copy link
Contributor

jyn514 commented Nov 7, 2020

Thanks for the PR!

@zregvart zregvart deleted the pr/consider-absolute-relative-to-dir branch November 7, 2020 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants