Fix diffurl links (cvsweb expects unescaped '/').

master
Amitai Schlair 2013-02-02 14:11:15 -05:00
parent 0f3f809a45
commit 91b477c087
2 changed files with 10 additions and 1 deletions

View File

@ -314,7 +314,9 @@ sub rcs_recentchanges ($) {
$oldrev =~ s/INITIAL/0/; $oldrev =~ s/INITIAL/0/;
$newrev =~ s/\(DEAD\)//; $newrev =~ s/\(DEAD\)//;
my $diffurl = defined $config{diffurl} ? $config{diffurl} : ""; my $diffurl = defined $config{diffurl} ? $config{diffurl} : "";
my $epage = uri_escape_utf8($page); my $epage = join('/',
map { uri_escape_utf8($_) } split('/', $page)
);
$diffurl=~s/\[\[file\]\]/$epage/g; $diffurl=~s/\[\[file\]\]/$epage/g;
$diffurl=~s/\[\[r1\]\]/$oldrev/g; $diffurl=~s/\[\[r1\]\]/$oldrev/g;
$diffurl=~s/\[\[r2\]\]/$newrev/g; $diffurl=~s/\[\[r2\]\]/$newrev/g;

View File

@ -388,6 +388,12 @@ sub test_rcs_diff {
@changes = IkiWiki::rcs_recentchanges(3); @changes = IkiWiki::rcs_recentchanges(3);
is_total_number_of_changes(\@changes, 1); is_total_number_of_changes(\@changes, 1);
unlike(
$changes[0]->{pages}->[0]->{diffurl},
qr/%2F/m,
q{path separators are preserved when UTF-8scaping filename},
);
my $changeset = 1; my $changeset = 1;
my $maxlines = undef; my $maxlines = undef;
@ -573,6 +579,7 @@ sub _generate_test_config {
$config{cvsrepo} = "$dir/repo"; $config{cvsrepo} = "$dir/repo";
$config{cvspath} = "ikiwiki"; $config{cvspath} = "ikiwiki";
use Cwd; $config{templatedir} = getcwd() . '/templates'; use Cwd; $config{templatedir} = getcwd() . '/templates';
$config{diffurl} = "/nonexistent/cvsweb/[[file]]";
IkiWiki::loadplugins(); IkiWiki::loadplugins();
IkiWiki::checkconfig(); IkiWiki::checkconfig();
} }