From 47ee292ba4c4241f489eca931c74540ea0e1ad64 Mon Sep 17 00:00:00 2001 From: Asher Date: Sat, 5 Feb 2022 21:10:26 +0800 Subject: [PATCH] vweb: make Context.mount_static_folder_at more robust (#13361) --- vlib/vweb/vweb.v | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vlib/vweb/vweb.v b/vlib/vweb/vweb.v index 391a34a5de..9327ae066c 100644 --- a/vlib/vweb/vweb.v +++ b/vlib/vweb/vweb.v @@ -644,7 +644,9 @@ pub fn (mut ctx Context) mount_static_folder_at(directory_path string, mount_pat return false } dir_path := directory_path.trim_right('/') - ctx.scan_static_directory(dir_path, mount_path[1..]) + + trim_mount_path := mount_path.trim_left('/').trim_right('/') + ctx.scan_static_directory(dir_path, '/$trim_mount_path') return true }