Comparison

plugins/mod_http_files.lua @ 6872:eb28067faadf

mod_http_files: Strip trailing directory separator regardless of directionality of the slash (fixes #545)
author Kim Alvefur <zash@zash.se>
date Sat, 26 Sep 2015 19:34:58 +0200
parent 6030:9b91242cc137
child 6873:6dae43341b44
comparison
equal deleted inserted replaced
6869:5ce783c37024 6872:eb28067faadf
60 local directory_index = opts.directory_index; 60 local directory_index = opts.directory_index;
61 local function serve_file(event, path) 61 local function serve_file(event, path)
62 local request, response = event.request, event.response; 62 local request, response = event.request, event.response;
63 local orig_path = request.path; 63 local orig_path = request.path;
64 local full_path = base_path .. (path and "/"..path or ""); 64 local full_path = base_path .. (path and "/"..path or "");
65 local attr = stat((full_path:gsub('%'..path_sep..'+$',''))); 65 local attr = stat(full_path:match("^.*[^\\/]")); -- Strip trailing path separator because Windows
66 if not attr then 66 if not attr then
67 return 404; 67 return 404;
68 end 68 end
69 69
70 local request_headers, response_headers = request.headers, response.headers; 70 local request_headers, response_headers = request.headers, response.headers;