]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
Fix diffurl links (cvsweb expects unescaped '/').
authorAmitai Schlair <schmonz-web-ikiwiki@schmonz.com>
Sat, 2 Feb 2013 19:11:15 +0000 (14:11 -0500)
committerAmitai Schlair <schmonz-web-ikiwiki@schmonz.com>
Sat, 2 Feb 2013 19:11:15 +0000 (14:11 -0500)
IkiWiki/Plugin/cvs.pm
t/cvs.t

index bccab3159b494cfc7f0757ec224f9f8be8ed8409..841aec914f7208df52036379319f4bdfda7ddc01 100644 (file)
@@ -314,7 +314,9 @@ sub rcs_recentchanges ($) {
                        $oldrev =~ s/INITIAL/0/;
                        $newrev =~ s/\(DEAD\)//;
                        my $diffurl = defined $config{diffurl} ? $config{diffurl} : "";
                        $oldrev =~ s/INITIAL/0/;
                        $newrev =~ s/\(DEAD\)//;
                        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/\[\[r1\]\]/$oldrev/g;
                        $diffurl=~s/\[\[r2\]\]/$newrev/g;
                        $diffurl=~s/\[\[file\]\]/$epage/g;
                        $diffurl=~s/\[\[r1\]\]/$oldrev/g;
                        $diffurl=~s/\[\[r2\]\]/$newrev/g;
diff --git a/t/cvs.t b/t/cvs.t
index d9b9ec48ebaf51602379796f16e2ec16e2f07f08..17598f7f72f82ac14a19a3d10cae1996889d37db 100755 (executable)
--- a/t/cvs.t
+++ b/t/cvs.t
@@ -388,6 +388,12 @@ sub test_rcs_diff {
        @changes = IkiWiki::rcs_recentchanges(3);
        is_total_number_of_changes(\@changes, 1);
 
        @changes = IkiWiki::rcs_recentchanges(3);
        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 $maxlines = undef;
        my $changeset = 1;
 
        my $maxlines = undef;
@@ -573,6 +579,7 @@ sub _generate_test_config {
        $config{cvsrepo} = "$dir/repo";
        $config{cvspath} = "ikiwiki";
        use Cwd; $config{templatedir} = getcwd() . '/templates';
        $config{cvsrepo} = "$dir/repo";
        $config{cvspath} = "ikiwiki";
        use Cwd; $config{templatedir} = getcwd() . '/templates';
+       $config{diffurl} = "/nonexistent/cvsweb/[[file]]";
        IkiWiki::loadplugins();
        IkiWiki::checkconfig();
 }
        IkiWiki::loadplugins();
        IkiWiki::checkconfig();
 }