diff options
author | Gaurav <allmanpride@gmail.com> | 2022-08-04 00:03:37 +0000 |
---|---|---|
committer | Gaurav <allmanpride@gmail.com> | 2022-08-14 00:03:55 +0000 |
commit | f56840a4c04b18fcc6955d7105d32ec9bd6b01dd (patch) | |
tree | f804a529d7f8bc36ea49e03496149f767158899c /src/listing.rs | |
parent | Replace `markdown` by `comrak`; Render support for nested dirs (diff) | |
download | miniserve-f56840a4c04b18fcc6955d7105d32ec9bd6b01dd.tar.gz miniserve-f56840a4c04b18fcc6955d7105d32ec9bd6b01dd.zip |
Satisfy cargo fmt
Diffstat (limited to '')
-rw-r--r-- | src/listing.rs | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/listing.rs b/src/listing.rs index 436add9..42054ca 100644 --- a/src/listing.rs +++ b/src/listing.rs @@ -283,14 +283,22 @@ pub fn directory_listing( last_modification_date, symlink_dest, )); - // TODO: Pattern match? - if conf.readme && file_name.to_lowercase() == "readme.md"{ - let file_path = conf.path.canonicalize().unwrap() - .join(base.as_os_str().to_str().unwrap() - .strip_prefix("/").unwrap()) - .join(&file_name); - readme = Some(file_path); - } + // TODO: Pattern match? + if conf.readme && file_name.to_lowercase() == "readme.md" { + let file_path = conf + .path + .canonicalize() + .unwrap() + .join( + base.as_os_str() + .to_str() + .unwrap() + .strip_prefix('/') + .unwrap(), + ) + .join(&file_name); + readme = Some(file_path); + } } } else { continue; @@ -381,7 +389,7 @@ pub fn directory_listing( HttpResponse::Ok().content_type(mime::TEXT_HTML_UTF_8).body( renderer::page( entries, - readme, + readme, is_root, query_params, breadcrumbs, |