Comparison

plugins/mod_http_files.lua @ 7229:dcc8ed11173c

mod_http_files: Don't prepend / to path twice, sanitize path does this already
author Kim Alvefur <zash@zash.se>
date Thu, 03 Mar 2016 15:30:00 +0100
parent 7228:b5b7ae2901e6
child 7230:20246b139607
comparison
equal deleted inserted replaced
7228:b5b7ae2901e6 7229:dcc8ed11173c
93 if path and not sanitized_path then 93 if path and not sanitized_path then
94 return 400; 94 return 400;
95 end 95 end
96 path = sanitized_path; 96 path = sanitized_path;
97 local orig_path = sanitize_path(request.path); 97 local orig_path = sanitize_path(request.path);
98 local full_path = base_path .. (path and "/"..path or ""):gsub("/", path_sep); 98 local full_path = base_path .. (path or ""):gsub("/", path_sep);
99 local attr = stat(full_path:match("^.*[^\\/]")); -- Strip trailing path separator because Windows 99 local attr = stat(full_path:match("^.*[^\\/]")); -- Strip trailing path separator because Windows
100 if not attr then 100 if not attr then
101 return 404; 101 return 404;
102 end 102 end
103 103