From bf20fce978857602ed54771de38fda2a1848e424 Mon Sep 17 00:00:00 2001 From: yggverse Date: Tue, 9 Sep 2025 00:10:35 +0300 Subject: [PATCH] rename to `path` method `filepath`, additionally validate the given location is file --- src/public.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/public.rs b/src/public.rs index 794b370..6dcd3d8 100644 --- a/src/public.rs +++ b/src/public.rs @@ -92,15 +92,15 @@ impl Public { } } - /// Return canonical absolute path + /// Return canonical absolute path to file /// /// * `None` if the given URI does not exist or has denied location - pub fn path(&self, relative: &str) -> Option { + pub fn filepath(&self, relative: &str) -> Option { let mut p = PathBuf::from(&self.root); p.push(&relative); let c = p.canonicalize().ok()?; - if c.starts_with(&self.root) && c.exists() { + if c.starts_with(&self.root) && c.exists() && c.is_file() { Some(c) } else { None