From 7b81b82bc7ff0aa4b4d8cc67c2899fe4b63bf9d1 Mon Sep 17 00:00:00 2001 From: vinhjaxt Date: Sun, 17 Apr 2022 18:31:29 +0700 Subject: [PATCH] update --- public/index | 1 + src/main.rs | 11 ++++------- 2 files changed, 5 insertions(+), 7 deletions(-) create mode 100644 public/index diff --git a/public/index b/public/index new file mode 100644 index 0000000..70c379b --- /dev/null +++ b/public/index @@ -0,0 +1 @@ +Hello world \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index b61e7c2..17994c3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -118,17 +118,14 @@ async fn main() -> std::io::Result<()> { .service( actix_files::Files::new("/", &public_folder) .path_filter(move |path, _| { - let ext = path.extension(); - if ext.is_none() { - return true; - } - let ext = ext.unwrap().to_str().unwrap().to_lowercase(); + let ext = match path.extension() { + Some(ext) => ext.to_str().unwrap().to_lowercase(), + None => return true + }; if is_include_exts { - let include_exts = include_exts.clone(); return include_exts.contains(&ext); } if is_exclude_exts { - let exclude_exts = exclude_exts.clone(); return !exclude_exts.contains(&ext); } true