Filter out directories with suffixes that look like extensions

Directories can still have a suffix which looks like
a file extension like `foo.html`. This can lead to
unexpected behavior with glob patterns like
`**/*.html`. Therefore filter these out.
https://github.com/lycheeverse/lychee/pull/262#issuecomment-91322681
This commit is contained in:
Matthias 2021-09-06 00:35:11 +02:00
parent f47282093a
commit 00ddb6dfc8

View file

@ -161,6 +161,14 @@ impl Input {
for entry in glob_with(&glob_expanded, match_opts)? {
match entry {
Ok(path) => {
if path.is_dir() {
// Directories can still have a suffix which looks like
// a file extension like `foo.html`. This can lead to
// unexpected behavior with glob patterns like
// `**/*.html`. Therefore filter these out.
// https://github.com/lycheeverse/lychee/pull/262#issuecomment-913226819
continue;
}
let content = Self::path_content(&path)?;
contents.push(content);
}