From a43a005f59902a88c31645e3aeedc8112da72671 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Emilio=20Gonz=C3=A1lez?= <emigr2k1@gmail.com>
Date: Wed, 11 Dec 2019 19:04:53 -0600
Subject: [PATCH] Log path if it is not a directory (#1208)

---
 actix-files/src/lib.rs | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/actix-files/src/lib.rs b/actix-files/src/lib.rs
index c33367d7..c45caf37 100644
--- a/actix-files/src/lib.rs
+++ b/actix-files/src/lib.rs
@@ -274,10 +274,14 @@ impl Files {
     /// By default pool with 5x threads of available cpus is used.
     /// Pool size can be changed by setting ACTIX_CPU_POOL environment variable.
     pub fn new<T: Into<PathBuf>>(path: &str, dir: T) -> Files {
-        let dir = dir.into().canonicalize().unwrap_or_else(|_| PathBuf::new());
-        if !dir.is_dir() {
-            log::error!("Specified path is not a directory: {:?}", dir);
-        }
+        let orig_dir = dir.into();
+        let dir = match orig_dir.canonicalize() {
+            Ok(canon_dir) => canon_dir,
+            Err(_) => {
+                log::error!("Specified path is not a directory: {:?}", orig_dir);
+                PathBuf::new()
+            }
+        };
 
         Files {
             path: path.to_string(),