aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorSven-Hendrik Haase <svenstaro@gmail.com>2025-03-09 09:35:50 +0000
committerSven-Hendrik Haase <svenstaro@gmail.com>2025-03-09 09:35:50 +0000
commit789c93163567ee1941981b7eade4ed326b053d28 (patch)
tree555409877d326e86c2935c6fa331a9476039cbd8 /src/main.rs
parentRewrite file traversal logic to not suffer from stack overflow problem (diff)
downloadminiserve-789c93163567ee1941981b7eade4ed326b053d28.tar.gz
miniserve-789c93163567ee1941981b7eade4ed326b053d28.zip
Better formatting
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index a7166ef..cd54bd8 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -461,9 +461,11 @@ async fn api(
let decoded_path = percent_decode_str(&path)
.decode_utf8()
.map_err(|e| RuntimeError::ParseError(path.clone(), e.to_string()))?;
+
// Convert the relative dir to an absolute path on the system.
let sanitized_path = file_utils::sanitize_path(&*decoded_path, true)
.expect("Expected a path to directory");
+
let full_path = config
.path
.canonicalize()