Software /
code /
prosody
Diff
plugins/mod_http_files.lua @ 6888:39c5c49616ab
Merge 0.10->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 27 Sep 2015 00:37:18 +0200 |
parent | 6887:da38775bda82 |
child | 7061:eda0feeaf759 |
line wrap: on
line diff
--- a/plugins/mod_http_files.lua Fri Sep 25 18:11:45 2015 +0200 +++ b/plugins/mod_http_files.lua Sun Sep 27 00:37:18 2015 +0200 @@ -61,8 +61,8 @@ local function serve_file(event, path) local request, response = event.request, event.response; local orig_path = request.path; - local full_path = base_path .. (path and "/"..path or ""); - local attr = stat((full_path:gsub('%'..path_sep..'+$',''))); + local full_path = base_path .. (path and "/"..path or ""):gsub("/", path_sep); + local attr = stat(full_path:match("^.*[^\\/]")); -- Strip trailing path separator because Windows if not attr then return 404; end