Skip to content

Commit 1c975ea

Browse files
committed
Auto merge of #34039 - ollie27:linkchecker_dirs, r=alexcrichton
linkchecker: Treat directory links as errors Directory links don't work well offline so they should be treated as errors. All examples of this I know of are fixed in #34021.
2 parents 8cbffc5 + 8e0baf4 commit 1c975ea

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/tools/linkchecker/main.rs

+6
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,12 @@ fn check(cache: &mut Cache,
191191
// exist! If it doesn't then we register and print an error.
192192
if path.exists() {
193193
if path.is_dir() {
194+
// Links to directories show as directory listings when viewing
195+
// the docs offline so it's best to avoid them.
196+
*errors = true;
197+
let pretty_path = path.strip_prefix(root).unwrap_or(&path);
198+
println!("{}:{}: directory link - {}", pretty_file.display(),
199+
i + 1, pretty_path.display());
194200
return;
195201
}
196202
let res = load_file(cache, root, path.clone(), FromRedirect(false));

0 commit comments

Comments
 (0)