fix directory links not including a trailing slash for subdirs, leading to the parent dir link going too far back

This commit is contained in:
Crispy 2024-07-19 10:21:26 +02:00
parent 1d3b295f0d
commit 97f4c4b37a

View file

@ -241,7 +241,7 @@ fn generate_index(relative_path: &str, path: &Path) -> Option<Content> {
let trailing_slash = if size.is_some() { "" } else { "/" };
let filename = format!("{name}{trailing_slash}");
let link = format!("<span><a href=\"{href}\">{filename}</a>");
let link = format!("<span><a href=\"{href}{trailing_slash}\">{filename}</a>");
let size = size.map(format_size).unwrap_or_default() + "</span>\n";
// NOTE: emojis in filenames will probably cause misalignment
let width = filename.chars().count();