vweb: make Context.mount_static_folder_at more robust (#13361)

pull/13376/head
Asher 2022-02-05 21:10:26 +08:00 committed by GitHub
parent 173b4652fb
commit 47ee292ba4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -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
}