# page they link to is deleted, or newly created, or
# changes for whatever reason. So this CGI handles that
# dynamic linking stuff.
# page they link to is deleted, or newly created, or
# changes for whatever reason. So this CGI handles that
# dynamic linking stuff.
- if (defined pagetype($link)) {
- IkiWiki::redirect($cgi, $config{url}.IkiWiki::beautify_urlpath("/".htmlpage($link)));
- }
- else {
- IkiWiki::redirect($cgi, $config{url}.IkiWiki::beautify_urlpath("/".$link));
- }
+ IkiWiki::redirect($cgi, urlto($link, undef, 1));
# Optimisation to avoid re-writing pages. Assumes commits never
# change (or that any changes are not important).
# Optimisation to avoid re-writing pages. Assumes commits never
# change (or that any changes are not important).
if (ref $change->{message}) {
foreach my $field (@{$change->{message}}) {
if (exists $field->{line}) {
if (ref $change->{message}) {
foreach my $field (@{$change->{message}}) {
if (exists $field->{line}) {
- $field->{line} =~ s/(?<!\\)\[\[/\\\[\[/g;
+ # escape html
+ $field->{line} = encode_entities($field->{line});
+ # escape links and preprocessor stuff
+ $field->{line} = encode_entities($field->{line}, '\[\]');
commitdate => displaytime($change->{when}, "%X %x"),
wikiname => $config{wikiname},
);
commitdate => displaytime($change->{when}, "%X %x"),
wikiname => $config{wikiname},
);
IkiWiki::run_hooks(pagetemplate => sub {
shift->(page => $page, destpage => $page,
template => $template, rev => $change->{rev});
IkiWiki::run_hooks(pagetemplate => sub {
shift->(page => $page, destpage => $page,
template => $template, rev => $change->{rev});