mod_http_files: Translate forward slashes to local directory separators
authorKim Alvefur <zash@zash.se>
Sat, 26 Sep 2015 17:35:56 +0000 (19:35 +0200)
committerKim Alvefur <zash@zash.se>
Sat, 26 Sep 2015 17:35:56 +0000 (19:35 +0200)
plugins/mod_http_files.lua

index 9d81f5405b5a01a9cfd96b4b3859b23808eca1d2..9839fed904be405de502550e94e348f84cf14025 100644 (file)
@@ -61,7 +61,7 @@ function serve(opts)
        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 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;