mod_http_files: Strip trailing directory separator regardless of directionality of...
authorKim Alvefur <zash@zash.se>
Sat, 26 Sep 2015 17:34:58 +0000 (19:34 +0200)
committerKim Alvefur <zash@zash.se>
Sat, 26 Sep 2015 17:34:58 +0000 (19:34 +0200)
plugins/mod_http_files.lua

index 3a9368b9a65160a5b44c98c9be4fd25f77040905..9d81f5405b5a01a9cfd96b4b3859b23808eca1d2 100644 (file)
@@ -62,7 +62,7 @@ function serve(opts)
                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 attr = stat(full_path:match("^.*[^\\/]")); -- Strip trailing path separator because Windows
                if not attr then
                        return 404;
                end