mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vweb: ignore url params on static files
This commit is contained in:
parent
0338d4153a
commit
bbd6d0b4e5
@ -270,9 +270,14 @@ fn handle_conn<T>(conn net.Socket, mut app T) {
|
|||||||
//continue
|
//continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// Serve a static file if it's one
|
// Serve a static file if it is one
|
||||||
static_file := app.vweb.static_files[app.vweb.req.url]
|
// TODO: handle url parameters properly - for now, ignore them
|
||||||
mime_type := app.vweb.static_mime_types[app.vweb.req.url]
|
mut static_file_name := app.vweb.req.url
|
||||||
|
if static_file_name.contains('?') {
|
||||||
|
static_file_name = static_file_name.all_before('?')
|
||||||
|
}
|
||||||
|
static_file := app.vweb.static_files[static_file_name]
|
||||||
|
mime_type := app.vweb.static_mime_types[static_file_name]
|
||||||
|
|
||||||
if static_file != '' && mime_type != '' {
|
if static_file != '' && mime_type != '' {
|
||||||
data := os.read_file(static_file) or {
|
data := os.read_file(static_file) or {
|
||||||
|
Loading…
Reference in New Issue
Block a user