lycheeverse / lychee

⚡ Fast, async, stream-based link checker written in Rust. Finds broken URLs and mail addresses inside Markdown, HTML, reStructuredText, websites and more!
https://lychee.cli.rs
Apache License 2.0
2.22k stars 134 forks source link

Weird/incorrect behaviour when checking local links #1503

Open fenuks opened 2 months ago

fenuks commented 2 months ago

I'm using lychee 0.15.1 on Arch Linux.

Here is an example markdown document:

# Incorrect or strange behaviour
## Links not being checked
- [ ] [Test1](~/Downloads/not checked because of space)
- [ ] [Test3](/home/nonsense/not-checked2-absolute-path)

## Links checking not working because of tilde
- [Test4](~/incorrect-check)
<!-- ✗ [ERR] file:///home/me/Documents/~/incorrect-check | Failed: Cannot find file -->

# Links checked correctly
- [Test5](./correct-check)
<!-- ✗ [ERR] file:///home/me/Documents/correct-check | Failed: Cannot find file -->
$ lychee test.md 
  2/2 ━━━━━━━━━━━━━━━━━━━━ Finished extracting links                                                             Issues found in 1 input. Find details below.

[test.md]:
✗ [ERR] file:///home/fenuks/Dokumenty/notatki/correct-check | Failed: Cannot find file
✗ [ERR] file:///home/fenuks/Dokumenty/notatki/~/incorrect-check | Failed: Cannot find file

🔍 2 Total (in 0s) ✅ 0 OK 🚫 2 Errors

It seems that lychee skips links with absolute path or spaces, and it doesn't handle links with ~ as absolute links.