webmcp
changeset 491:7a7770297ae8
Fixed error in error handling when catching illegal static path
author | jbe |
---|---|
date | Tue Jun 27 15:38:24 2017 +0200 (2017-06-27) |
parents | b29e082cafb8 |
children | 93ebbc1e5dbc |
files | framework/env/request/handler.lua |
line diff
1.1 --- a/framework/env/request/handler.lua Sun Jun 18 03:03:48 2017 +0200 1.2 +++ b/framework/env/request/handler.lua Tue Jun 27 15:38:24 2017 +0200 1.3 @@ -67,14 +67,15 @@ 1.4 1.5 if request._route.static then 1.6 local subpath = request._route.static 1.7 + local errmsg 1.8 for element in string.gmatch(subpath, "[^/]+") do 1.9 if element == "." or element == ".." then 1.10 - subpath = nil 1.11 + errmsg = "Illegal path" 1.12 break 1.13 end 1.14 end 1.15 - local fstat, f, errmsg 1.16 - if subpath then 1.17 + local fstat, f 1.18 + if not errmsg then 1.19 local filename = WEBMCP_BASE_PATH .. "static/" .. subpath 1.20 fstat, errmsg = extos.stat(filename) 1.21 if fstat then