Author: dom Date: 2005-06-13 01:37:56 +0100 (Mon, 13 Jun 2005) New Revision: 648
Modified: trunk/lib/OpenGuides.pm Log: Fix redirection loops, RT #13205
Modified: trunk/lib/OpenGuides.pm =================================================================== --- trunk/lib/OpenGuides.pm 2005-06-13 00:22:40 UTC (rev 647) +++ trunk/lib/OpenGuides.pm 2005-06-13 00:37:56 UTC (rev 648) @@ -170,13 +170,15 @@ $redirect =~ s/^[[//; $redirect =~ s/]]\s*$//; # See if this is a valid node, if not then just show the page as-is. - if ( $wiki->node_exists($redirect) ) { + # Avoid loops by not generating redirects to the same node or the + # previous node. + if ( $wiki->node_exists($redirect) && $redirect != $id && $redirect != $oldid ) { my $output = $self->redirect_to_node($redirect, $id); return $output if $return_output; print $output; exit 0; - } } + } my $content = $wiki->format($raw); my $modified = $node_data{last_modified}; my %metadata = %{$node_data{metadata}};