summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2023-03-08 20:37:06 +0100
committermetamuffin <metamuffin@disroot.org>2023-03-08 20:37:06 +0100
commit7bcbf526f357aca014e6bff8e833572ba38f721f (patch)
treed190835582b60819beb23666d36eacd695e03b60
parenta3fb25019336ab9238d73f29a004b71cfc31a032 (diff)
downloadgnix-7bcbf526f357aca014e6bff8e833572ba38f721f.tar
gnix-7bcbf526f357aca014e6bff8e833572ba38f721f.tar.bz2
gnix-7bcbf526f357aca014e6bff8e833572ba38f721f.tar.zst
dont show hidden files
-rw-r--r--src/files.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/files.rs b/src/files.rs
index 555e8ae..2ba9a9f 100644
--- a/src/files.rs
+++ b/src/files.rs
@@ -200,6 +200,7 @@ async fn index(path: &Path, rpath: String) -> Result<String, ServiceError> {
let 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<_>, _>>()?;
if let Ok(indexhtml) = read_to_string(path.join("index.html")).await {
Ok(indexhtml)