Author: henkp Date: Wed Apr 11 09:27:52 2018 New Revision: 1828884 URL: http://svn.apache.org/viewvc?rev=1828884&view=rev Log: fix add-banner
Modified: attic/site/docs/scripts/add-banner.lua Modified: attic/site/docs/scripts/add-banner.lua URL: http://svn.apache.org/viewvc/attic/site/docs/scripts/add-banner.lua?rev=1828884&r1=1828883&r2=1828884&view=diff ============================================================================== --- attic/site/docs/scripts/add-banner.lua (original) +++ attic/site/docs/scripts/add-banner.lua Wed Apr 11 09:27:52 2018 @@ -82,7 +82,7 @@ function change_loc() </html> ]=] -local PROG = 'scripts/add-banner.lua' ; +local PROG = '/scripts/add-banner.lua/' ; local ATTIC_DIR = '/var/www/attic.apache.org/' local ATTIC_PRJS = ATTIC_DIR .. 'flagged/' @@ -92,8 +92,9 @@ function in_attic(p) return exists ( ATT function handle(r) local get = r:parseargs() local err = nil - local PROJ - local PATH + local HOST = r:hostname() + local PROJ, _ = string.gsub ( HOST, '.apache.org', '' ) + local PATH = r.pathinfo() local TEST = false r.content_type = "text/html" @@ -122,7 +123,10 @@ function handle(r) if err ~= nil then r:puts(err) return apache2.OK end if not TEST and not get.test and not in_attic(PROJ) then - err = "project is not in attic [" .. PROJ .. "] [" .. r.unparsed_uri .. "]" + err = "project is not in attic" + .. " PROJ [" .. PROJ .. "]" + .. " HOST [" .. HOST .. "]" + .. " PATH [" .. PATH .. "]" end if err ~= nil then @@ -131,7 +135,7 @@ function handle(r) local text = TEMPL local subs = { ['!PROJ!'] = PROJ - , ['!HOST!'] = PROJ .. '.apache.org' + , ['!HOST!'] = HOST , ['!PATH!'] = PATH } for k, v in pairs ( subs ) do text, _ = string.gsub ( text, k, v ) end