From: b Date: Mon, 12 Feb 2024 23:15:11 +0000 (+0000) Subject: improve GOTO handling X-Git-Tag: v1.2.7~2 X-Git-Url: http://bicyclesonthemoon.info/git-projects/?a=commitdiff_plain;h=b893744860cbc4aa4b94d190b01008d60177e2f0;p=ott%2Fbsta improve GOTO handling --- diff --git a/bsta_lib.1.pm b/bsta_lib.1.pm index 7545a90..8add7fa 100644 --- a/bsta_lib.1.pm +++ b/bsta_lib.1.pm @@ -1177,7 +1177,10 @@ sub print_viewer_page { merge_url( {'path' => $viewer_url}, { - 'query' => {'g' => 1}, + 'query' => { + 'g' => 1, + 'b' => $text_mode + }, 'fragment' => 'goto' } ); @@ -1498,8 +1501,8 @@ sub print_viewer_page { print $fh 'GOTO'."\n"; print $fh ' '."\n "; if ( - ($text_mode == TEXT_MODE->{'normal'}) && - (!$goto) + ($text_mode == TEXT_MODE->{'normal'}) + # && (!$goto) ){ if ($show_words) { print $fh ''.$words_link_text.' | '; diff --git a/viewer.1.pl b/viewer.1.pl index c7d74d9..338eb87 100644 --- a/viewer.1.pl +++ b/viewer.1.pl @@ -52,6 +52,7 @@ use bsta_lib ( ###PERL_PATH_SEPARATOR: PATH_SEPARATOR = / ###PERL_CGI_PATH: CGI_PATH = /bsta/ +###PERL_CGI_GOTO_PATH: CGI_GOTO_PATH = /bsta/g ###PERL_CGI_VIEWER_PATH: CGI_VIEWER_PATH = /bsta/v ###PERL_DATA_STATE_PATH: DATA_STATE_PATH = /botm/data/bsta/state @@ -121,6 +122,16 @@ if ($method eq 'POST') { exit fail_content_type($method, $http{'content-type'}); } } + +if ( + (defined $cgi{'f'}) && + ($cgi{'f'} eq '') && + ($cgi{'g'} ne '') +) { # GOTO with no value + exit redirect($method, CGI_GOTO_PATH(), HTTP_STATUS->{'see_other'}); +} + + $no_cgi = (scalar (keys %cgi) == 0); $IP = get_remote_addr();