# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1443288898 -7200
# Node ID eb28067faadf57c9a584d466c4b3e80005e96d7c
# Parent  5ce783c3702418d6bfe588904187f3546ae449dd
mod_http_files: Strip trailing directory separator regardless of directionality of the slash (fixes #545)

diff -r 5ce783c37024 -r eb28067faadf plugins/mod_http_files.lua
--- a/plugins/mod_http_files.lua	Fri Sep 18 16:14:43 2015 +0200
+++ b/plugins/mod_http_files.lua	Sat Sep 26 19:34:58 2015 +0200
@@ -62,7 +62,7 @@
 		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