From f231ada25549502c60839a1b1de1edd1314541bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 28 Jan 2019 17:57:58 +0800 Subject: =?UTF-8?q?=E4=BF=AE=E6=AD=A3bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/path_filter.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'server/src/path_filter.lua') diff --git a/server/src/path_filter.lua b/server/src/path_filter.lua index fb39a6f8..403c938c 100644 --- a/server/src/path_filter.lua +++ b/server/src/path_filter.lua @@ -1,6 +1,6 @@ local m = require 'lpeglabel' -local m_cut = m.S'/\\' +local m_cut = m.S'\\' local m_path = (1-m_cut)^1 local function match_any(p, pass) @@ -20,16 +20,17 @@ local function compile_format(fmt) end local function compile_exp(exp) - if exp:sub(1, 1) == '/' then + exp = exp:gsub('/', '\\') + if exp:sub(1, 1) == '\\' then exp = exp:sub(2) else - exp = '**/' .. exp + exp = '**\\' .. exp end - if exp:sub(-1) == '/' then + if exp:sub(-1) == '\\' then exp = exp:sub(1, -2) end local function next(cur) - local pos, fn = exp:find('[/\\]+', cur) + local pos, fn = exp:find('[\\]+', cur) if not pos then return compile_format(exp:sub(cur)) end -- cgit v1.2.3