From 844c6265c019f53f4ca65b5d8c7d55b9a306e024 Mon Sep 17 00:00:00 2001 From: sigoden Date: Thu, 26 May 2022 19:54:29 +0800 Subject: [PATCH] feat: remove parent path --- src/index.html | 2 +- src/server.rs | 12 ------------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/index.html b/src/index.html index d77b8a0..f095e2c 100644 --- a/src/index.html +++ b/src/index.html @@ -104,7 +104,7 @@ } function addPath(file, index) { - const actionTd = file.name === ".." || readonly ? "" : ` + const actionTd = readonly ? "" : `
diff --git a/src/server.rs b/src/server.rs index 45ac63a..ff20147 100644 --- a/src/server.rs +++ b/src/server.rs @@ -143,18 +143,6 @@ impl InnerService { let base_path = &self.args.path; let mut rd = fs::read_dir(path).await?; let mut paths: Vec = vec![]; - if self.args.path != path { - paths.push(PathItem { - path_type: PathType::Dir, - name: "..".to_owned(), - path: format!( - "/{}", - normalize_path(path.parent().unwrap().strip_prefix(base_path).unwrap()) - ), - mtime: None, - size: None, - }) - } while let Some(entry) = rd.next_entry().await? { let entry_path = entry.path(); let rel_path = entry_path.strip_prefix(base_path).unwrap();