aboutsummaryrefslogtreecommitdiff
path: root/bulkredirect.lua
diff options
context:
space:
mode:
Diffstat (limited to 'bulkredirect.lua')
-rw-r--r--bulkredirect.lua29
1 files changed, 23 insertions, 6 deletions
diff --git a/bulkredirect.lua b/bulkredirect.lua
index e1cf7bc..211d335 100644
--- a/bulkredirect.lua
+++ b/bulkredirect.lua
@@ -271,12 +271,12 @@ end
local function set_dst (dt, src, dst)
local path, query = src:match('^(.+)?(.+)')
if path then
- if not dt[src] then
- dt[src] = {nil, {}}
- elseif type(dt[src]) == 'string' then
- dt[src] = { { dt[src] }, {} }
+ if not dt[path] then
+ dt[path] = {nil, {}}
+ elseif type(dt[path]) == 'string' then
+ dt[path] = { { dt[path] }, {} }
end
- dt[src][2][query] = dst
+ dt[path][2][query] = dst
elseif type(dt[src]) == 'table' then
dt[src][1] = dst
elseif type(dst) == 'table' then
@@ -374,7 +374,23 @@ local function load_redirect_file (f, filename)
optab = clone(domopt)
parseopt(optlist, optab, filename .. ':' .. ln)
end
-
+
+ local dpath, dquery = dst:match('^(.+)?(.*)')
+ if dpath then
+ if optab['strippath'] == false and optab['strippath'] ~= domopt['strippath'] then
+ core.Warning(filename .. ':' .. ln .. ': nostrippath ignored because of explicit query in the destination')
+ end
+ if optab['stripquery'] == false and optab['stripquery'] ~= domopt['stripquery'] then
+ core.Warning(filename .. ':' .. ln .. ': nostripquery ignored because of explicit query in the destination')
+ end
+
+ optab['strippath'] = true
+ optab['stripquery'] = true
+ if dquery == '' then
+ dst = dpath
+ end
+ end
+
if optab['exact'] ~= exact then
if type(dst) == 'string' then dst = { dst } end
dst[2] = optab['exact']
@@ -449,6 +465,7 @@ local function load_redirect_table ()
if not status then
core.Alert(err)
end
+-- print(require('inspect')(rt))
else
core.Alert("can't open " .. name .. ": " .. err)
end

Return to:

Send suggestions and report system problems to the System administrator.