Mercurial > prosody-hg
comparison plugins/mod_http_files.lua @ 6873:6dae43341b44
mod_http_files: Translate forward slashes to local directory separators
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 26 Sep 2015 19:35:56 +0200 |
| parents | eb28067faadf |
| children | da38775bda82 e9f07febafb3 |
comparison
equal
deleted
inserted
replaced
| 6872:eb28067faadf | 6873:6dae43341b44 |
|---|---|
| 59 local dir_indices = opts.index_files or dir_indices; | 59 local dir_indices = opts.index_files or dir_indices; |
| 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 ""):gsub("/", path_sep); |
| 65 local attr = stat(full_path:match("^.*[^\\/]")); -- Strip trailing path separator because Windows | 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 |
