Author: dom
Date: 2007-06-10 16:21:02 +0100 (Sun, 10 Jun 2007)
New Revision: 1057
Modified:
trunk/Changes
trunk/wiki.cgi
Log:
If an unknown action is used redirect to action=display, preserving other args (see #102)
Modified: trunk/Changes
===================================================================
--- trunk/Changes 2007-06-10 14:47:11 UTC (rev 1056)
+++ trunk/Changes 2007-06-10 15:21:02 UTC (rev 1057)
@@ -14,6 +14,8 @@
Only display the google maps preference if node maps are enabled
(#192).
Respect redirect=0 (#104).
+ If an unknown action is supplied to wiki.cgi, redirect to
+ action=display (partial fix for #102)
0.60 13 May 2007
Removed footer search from edit page (shouldn't have been there).
Modified: trunk/wiki.cgi
===================================================================
--- trunk/wiki.cgi 2007-06-10 14:47:11 UTC (rev 1056)
+++ trunk/wiki.cgi 2007-06-10 15:21:02 UTC (rev 1057)
@@ -186,7 +186,7 @@
print $q->redirect( $redir_target );
} elsif ($action eq 'about') {
$guide->display_about(format => $format);
- } else { # Default is to display a node.
+ } elsif ($action eq 'display') {
if ( $format and $format eq "rdf" ) {
display_node_rdf( node => $node );
} elsif ( $format and $format eq 'raw' ) {
@@ -220,7 +220,23 @@
);
}
}
+ } else {
+ # Fallback: redirect to the display page, preserving all vars
+ # except for the action, which we override.
+ # Note: $q->Vars needs munging if we need to support any
+ # multi-valued params
+ my $params = $q->Vars;
+ $params->{'action'} = 'display';
+ my $redir_target = $script_url . $script_name . '?';
+ my @args = map { "$_=" . $params->{$_} } keys %{$params};
+ $redir_target .= join ';', @args;
+
+ print $q->redirect(
+ -uri => $redir_target,
+ -status => 303
+ );
}
+
};
if ($@) {