Merge 0.9->0.10
authorKim Alvefur <zash@zash.se>
Sat, 26 Sep 2015 22:36:34 +0000 (00:36 +0200)
committerKim Alvefur <zash@zash.se>
Sat, 26 Sep 2015 22:36:34 +0000 (00:36 +0200)
1  2 
plugins/mod_http_files.lua

index 2e9f418298ff244614312d2fafd553e2e2371559,9839fed904be405de502550e94e348f84cf14025..7c503c826cde665db207d75f1020ab092722e6d8
@@@ -1,7 -1,7 +1,7 @@@
  -- Prosody IM
  -- Copyright (C) 2008-2010 Matthew Wild
  -- Copyright (C) 2008-2010 Waqas Hussain
 --- 
 +--
  -- This project is MIT/X11 licensed. Please see the
  -- COPYING file in the source package for more information.
  --
@@@ -61,8 -61,8 +61,8 @@@ 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 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