3 * Add a link to a non-existant page and save. (e.g. [[somewhere-over-the-rainbow]])
4 * Click the question mark to create the page.
5 * Click the cancel button.
7 You get a 404 as the page doesn't exist. This patch redirects to the from location
11 === modified file 'IkiWiki/CGI.pm'
17 if ($form->submitted eq "Cancel") {
18 - redirect($q, "$config{url}/".htmlpage($page));
19 + if ( $newpage && defined $from ) {
20 + redirect($q, "$config{url}/".htmlpage($from));
22 + redirect($q, "$config{url}/".htmlpage($page));
26 elsif ($form->submitted eq "Preview") {
30 [P.S. just above that is
32 $type=$form->param('type');
33 if (defined $type && length $type && $hooks{htmlize}{$type}) {
34 $type=possibly_foolish_untaint($type);
37 $file=$page.".".$type;
39 I'm a little worried by the `possibly_foolish_untaint` (good name for it by the way,
40 makes it stick out). I don't think much can be done to exploit this (if anything),
41 but it seems like you could have a very strict regex there rather than the untaint,
42 is there aren't going to be many possible extensions. Something like `/(.\w+)+/`
43 (groups of dot separated alpha-num chars if my perl-foo isn't failing me). You could
44 at least exclude `/` and `..`. I'm happy to turn this in to a patch if you agree.]