# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1443306994 -7200
# Node ID da38775bda82c940ee11cf9048533a8b7eb4b19d
# Parent  27f5a76e3fa51d44125fb0445fb61665e2e084a0# Parent  6dae43341b44033a96104eff22e25e7bb9edcfe6
Merge 0.9->0.10

diff -r 27f5a76e3fa5 -r da38775bda82 plugins/mod_http_files.lua
--- a/plugins/mod_http_files.lua	Sun Sep 27 00:28:46 2015 +0200
+++ b/plugins/mod_http_files.lua	Sun Sep 27 00:36:34 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