Changeset 1056


Ignore:
Timestamp:
Jun 10, 2007, 3:47:11 PM (14 years ago)
Author:
Dagfinn Ilmari Mannsåker
Message:

Check for definedness of redirect parameter before defaulting to 1 (closes #104).

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Changes

    r1050 r1056  
    1414        Only display the google maps preference if node maps are enabled
    1515          (#192).
     16        Respect redirect=0 (#104).
    1617
    17180.60    13 May 2007
  • trunk/lib/OpenGuides.pm

    r1045 r1056  
    176176    my $config = $self->config;
    177177    my $oldid = $args{oldid} || '';
    178     my $do_redirect = $args{redirect} || 1;
     178    my $do_redirect = defined($args{redirect}) ? $args{redirect} : 1;
    179179
    180180    my %tt_vars;
  • trunk/t/51_display_node.t

    r957 r1056  
    1313}
    1414
    15 plan tests => 7;
     15plan tests => 9;
    1616
    1717Wiki::Toolkit::Setup::SQLite::setup( { dbname => "t/node.db" } );
     
    4848my %tt_vars = $guide->display_node( return_tt_vars => 1 );
    4949ok( defined $tt_vars{recent_changes}, "...and recent_changes is set for the home node even if we have changed its name" );
     50
     51$wiki->write_node( 'Redirect Test', '#REDIRECT Test Page', undef );
     52
     53$output = $guide->display_node( id => 'Redirect Test', return_output => 1 );
     54
     55like( $output, qr{^\QLocation: http://example.com/wiki.cgi?id=Test_Page;oldid=Redirect_Test}ms,
     56      '#REDIRECT redirects correctly' );
     57
     58$output = $guide->display_node( id => 'Redirect Test', return_output => 1, redirect => 0 );
     59
     60unlike( $output, qr{^\QLocation: }ms, '...but not with redirect=0' );
Note: See TracChangeset for help on using the changeset viewer.