aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/modules/files.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/modules/files.rs b/src/modules/files.rs
index a37098d..7d6665a 100644
--- a/src/modules/files.rs
+++ b/src/modules/files.rs
@@ -337,11 +337,14 @@ fn reserve_at_least(buf: &mut BytesMut, cap: usize) {
}
async fn index(path: &Path, rpath: String) -> Result<String, ServiceError> {
- let files = path
+ let mut files = path
.read_dir()?
.map(|e| e.and_then(|e| Ok((e.file_name().into_string().unwrap(), e.metadata()?))))
.filter(|e| e.as_ref().map(|(e, _)| !e.starts_with(".")).unwrap_or(true))
.collect::<Result<Vec<_>, _>>()?;
+
+ files.sort_by(|a, b| a.0.cmp(&b.0));
+
let banner = read_to_string(path.join("index.banner.html")).await.ok();
let s = IndexTemplate {
files,