diff options
author | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-03-08 06:03:59 +0000 |
---|---|---|
committer | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-03-08 06:03:59 +0000 |
commit | c1b698e4181002eeecdb5988ea767cae67a83a49 (patch) | |
tree | f5ed6d2a2269fe3bc6c696268b976a6d2b9871d5 /IkiWiki | |
parent | 8430ee09e5702a63f6aee5876bda2f5edf1b8816 (diff) | |
download | ikiwiki-c1b698e4181002eeecdb5988ea767cae67a83a49.tar ikiwiki-c1b698e4181002eeecdb5988ea767cae67a83a49.tar.gz |
* The underscore escaping support exposed a bug in edit links: Such links
were titlepage escaped in the urls, and then doubly escaped by the CGI
when editing. To fix this, I removed the titlepage escaping in the edit
urls.
* That means that *every edit link* on the wiki is potentially changed.
Rebuilding wikis on upgrade to this version therefore necessary; enabled
that in postinst.
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/CGI.pm | 13 | ||||
-rw-r--r-- | IkiWiki/Plugin/inline.pm | 2 | ||||
-rw-r--r-- | IkiWiki/Render.pm | 2 |
3 files changed, 7 insertions, 10 deletions
diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm index aeccd31ac..05f4c6e0f 100644 --- a/IkiWiki/CGI.pm +++ b/IkiWiki/CGI.pm @@ -286,10 +286,9 @@ 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); @@ -323,9 +322,6 @@ 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"); } @@ -362,7 +358,7 @@ sub cgi_editpage ($$;$) { #{{{ $form->field(name => "from", type => 'hidden'); $form->field(name => "rcsinfo", type => 'hidden'); $form->field(name => "subpage", type => 'hidden'); - $form->field(name => "page", value => $page, force => 1); + $form->field(name => "page", value => pagetitle($page, 1), force => 1); $form->field(name => "type", value => $type, force => 1); $form->field(name => "comments", type => "text", size => 80); $form->field(name => "editcontent", type => "textarea", rows => 20, @@ -686,6 +682,7 @@ sub cgi (;$$) { #{{{ } elsif ($do eq 'blog') { my $page=decode_utf8($q->param('title')); + $page=~s/\///g; # no slashes in blog posts # if the page already exists, munge it to be unique my $from=$q->param('from'); my $add=""; @@ -694,9 +691,9 @@ sub cgi (;$$) { #{{{ $add++; } $q->param('page', $page.$add); - # now run same as create, except escape slashes too + # now run same as create $q->param('do', 'create'); - cgi_editpage($q, $session, 1); + cgi_editpage($q, $session); } elsif ($do eq 'postsignin') { error(gettext("login failed, perhaps you need to turn on cookies?")); diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index 6656a821c..4dbf9f159 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -184,7 +184,7 @@ sub preprocess_inline (@) { #{{{ } if (length $config{cgiurl} && defined $type) { $template->param(have_actions => 1); - $template->param(editurl => cgiurl(do => "edit", page => $page)); + $template->param(editurl => cgiurl(do => "edit", page => pagetitle($page, 1))); } } diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index 80c99e430..990b803de 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -79,7 +79,7 @@ sub genpage ($$$) { #{{{ my $actions=0; if (length $config{cgiurl}) { - $template->param(editurl => cgiurl(do => "edit", page => $page)); + $template->param(editurl => cgiurl(do => "edit", page => pagetitle($page, 1))); $template->param(prefsurl => cgiurl(do => "prefs")); if ($config{rcs}) { $template->param(recentchangesurl => cgiurl(do => "recentchanges")); |