From b0a35c817e453a8d19fb3d52a093e3aee68c66aa Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Sun, 5 Oct 2014 15:19:55 +0100 Subject: [PATCH] Force use of $config{url} as top URL in w3mmode --- IkiWiki/CGI.pm | 5 ++++- .../W3MMode_still_uses_http:__47____47__localhost__63__.mdwn | 2 ++ t/relativity.t | 3 --- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm index cb83319e6..b6f47a3a7 100644 --- a/IkiWiki/CGI.pm +++ b/IkiWiki/CGI.pm @@ -58,7 +58,10 @@ sub cgitemplate ($$$;@) { 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=""; if (exists $params{page}) { diff --git a/doc/bugs/W3MMode_still_uses_http:__47____47__localhost__63__.mdwn b/doc/bugs/W3MMode_still_uses_http:__47____47__localhost__63__.mdwn index 34eecef8c..c21329bae 100644 --- a/doc/bugs/W3MMode_still_uses_http:__47____47__localhost__63__.mdwn +++ b/doc/bugs/W3MMode_still_uses_http:__47____47__localhost__63__.mdwn @@ -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. -- Martin + +> [[Fixed|done]] --[[smcv]] diff --git a/t/relativity.t b/t/relativity.t index 8903d03cc..0f7d014c5 100755 --- a/t/relativity.t +++ b/t/relativity.t @@ -521,11 +521,8 @@ run(["./t/tmp/ikiwiki.cgi"], \undef, \$content, init => sub { %bits = parse_cgi_content($content); like($bits{tophref}, qr{^(?:\Q$pwd\E/t/tmp/out|\.)/$}); 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{stylehref}, qr{^(?:(?:(?:file:)?//)?\Q$pwd\E/t/tmp/out|\.)/style.css$}); -} ####################################################################### # site 6: we're behind a reverse-proxy -- 2.39.5