exclude symlinks from index

This commit is contained in:
Crispy 2024-03-26 20:03:46 +01:00
parent 46a42710e1
commit 331129fc06

View file

@ -183,7 +183,11 @@ fn generate_index(relative_path: &str, path: &Path) -> Option<Content> {
.ok()? .ok()?
.flatten() .flatten()
.filter_map(|d| { .filter_map(|d| {
let size = if d.file_type().ok()?.is_dir() { let file_type = d.file_type().ok()?;
if !(file_type.is_file() || file_type.is_dir()) {
return None;
}
let size = if file_type.is_dir() {
None None
} else { } else {
Some(d.metadata().ok()?.len()) Some(d.metadata().ok()?.len())