Force use of $config{url} as top URL in w3mmode

master
Simon McVittie 2014-10-05 15:19:55 +01:00
parent 210bf742b9
commit b0a35c817e
3 changed files with 6 additions and 4 deletions

View File

@ -58,7 +58,10 @@ sub cgitemplate ($$$;@) {
my $template=template("page.tmpl"); my $template=template("page.tmpl");
my $topurl = defined $cgi ? $cgi->url : $config{url}; my $topurl = $config{url};
if (defined $cgi && ! $config{w3mmode}) {
$topurl = $cgi->url;
}
my $page=""; my $page="";
if (exists $params{page}) { if (exists $params{page}) {

View File

@ -32,3 +32,5 @@ The problem is that IkiWiki::CGI::cgitemplate() and IkiWiki::CGI::redirect() use
A quick workaround might be to force the use of $config{url} instead of $cgi->url as a base for URLs when w3mmode is set. A quick workaround might be to force the use of $config{url} instead of $cgi->url as a base for URLs when w3mmode is set.
-- Martin -- Martin
> [[Fixed|done]] --[[smcv]]

View File

@ -521,11 +521,8 @@ run(["./t/tmp/ikiwiki.cgi"], \undef, \$content, init => sub {
%bits = parse_cgi_content($content); %bits = parse_cgi_content($content);
like($bits{tophref}, qr{^(?:\Q$pwd\E/t/tmp/out|\.)/$}); like($bits{tophref}, qr{^(?:\Q$pwd\E/t/tmp/out|\.)/$});
like($bits{cgihref}, qr{^(?:file://)?/\$LIB/ikiwiki-w3m.cgi/ikiwiki.cgi$}); like($bits{cgihref}, qr{^(?:file://)?/\$LIB/ikiwiki-w3m.cgi/ikiwiki.cgi$});
TODO: {
local $TODO = "should be file:///";
like($bits{basehref}, qr{^(?:(?:file:)?//)?\Q$pwd\E/t/tmp/out/$}); like($bits{basehref}, qr{^(?:(?:file:)?//)?\Q$pwd\E/t/tmp/out/$});
like($bits{stylehref}, qr{^(?:(?:(?:file:)?//)?\Q$pwd\E/t/tmp/out|\.)/style.css$}); like($bits{stylehref}, qr{^(?:(?:(?:file:)?//)?\Q$pwd\E/t/tmp/out|\.)/style.css$});
}
####################################################################### #######################################################################
# site 6: we're behind a reverse-proxy # site 6: we're behind a reverse-proxy