Index: Save.pm =================================================================== --- Save.pm (revision 6380) +++ Save.pm (working copy) @@ -393,8 +393,19 @@ if( $lease && $lease->{user}->equals( $user )) { $store->clearLease( $webName, $topic ); } - my $viewURL = $session->getScriptUrl( $webName, $topic, 'view' ); + + # check that the page already exist before redirecting to it + my $viewURL; + if ( $store->topicExists( $webName, $topic ) ) { + $viewURL = $session->getScriptUrl( $webName, $topic, 'view' ) . '?unlock=on'; + } elsif ( $query->param( 'topicparent' ) && + $store->topicExists( $webName, $query->param('topicparent') ) ) { # else go to parent + $viewURL = $session->getScriptUrl( $webName, $query->param( 'topicparent' ), 'view' ); + } else { # last resort: web home + $viewURL = $session->getScriptUrl( $webName, $TWiki::cfg{HomeTopicName}, 'view' ); + } $session->redirect( $viewURL ); + return; } elsif( $saveaction =~ /^(del|rep)Rev$/ ) {