diff options
author | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-03-07 09:48:59 +0000 |
---|---|---|
committer | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-03-07 09:48:59 +0000 |
commit | b365d864c507c9f6e3374c1fb7c854ddb495aeae (patch) | |
tree | e8e4f848c6374d64394421a3c0b28da622896ba3 /IkiWiki | |
parent | b39495f5015d0e5037db7682a2dc625abb26c5b8 (diff) |
My fix to support encoded underscores in page titles broke links to pages
with underscores in their filenames, since the link code also used
titlepage. Create a new linkpage function and have the link code use that
instead.
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/CGI.pm | 11 | ||||
-rw-r--r-- | IkiWiki/Render.pm | 2 |
2 files changed, 8 insertions, 5 deletions
diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm index b884a32f2..aeccd31ac 100644 --- a/IkiWiki/CGI.pm +++ b/IkiWiki/CGI.pm @@ -286,9 +286,10 @@ sub cgi_prefs ($$) { #{{{ } } #}}} -sub cgi_editpage ($$) { #{{{ +sub cgi_editpage ($$;$) { #{{{ my $q=shift; my $session=shift; + my $blogpost=shift; my @fields=qw(do rcsinfo subpage from page type editcontent comments newfile); @@ -322,6 +323,9 @@ sub cgi_editpage ($$) { #{{{ # characters. my ($page)=$form->field('page'); $page=titlepage(possibly_foolish_untaint($page)); + if ($blogpost) { + $page=~s/(\/)/"__".ord($1)."__"/eg; + } if (! defined $page || ! length $page || file_pruned($page, $config{srcdir}) || $page=~/^\//) { error("bad page name"); } @@ -682,7 +686,6 @@ sub cgi (;$$) { #{{{ } elsif ($do eq 'blog') { my $page=decode_utf8($q->param('title')); - $page=~s/\// /g; # remove slashes to avoid accidental subpages # if the page already exists, munge it to be unique my $from=$q->param('from'); my $add=""; @@ -691,9 +694,9 @@ sub cgi (;$$) { #{{{ $add++; } $q->param('page', $page.$add); - # now run same as create + # now run same as create, except escape slashes too $q->param('do', 'create'); - cgi_editpage($q, $session); + cgi_editpage($q, $session, 1); } elsif ($do eq 'postsignin') { error(gettext("login failed, perhaps you need to turn on cookies?")); diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index 3545df05a..80c99e430 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -157,7 +157,7 @@ sub scan ($) { #{{{ my @links; while ($content =~ /(?<!\\)$config{wiki_link_regexp}/g) { - push @links, titlepage($2); + push @links, linkpage($2); } if ($config{discussion}) { # Discussion links are a special case since they're |