From b893744860cbc4aa4b94d190b01008d60177e2f0 Mon Sep 17 00:00:00 2001 From: b Date: Mon, 12 Feb 2024 23:15:11 +0000 Subject: [PATCH] improve GOTO handling --- bsta_lib.1.pm | 9 ++++++--- viewer.1.pl | 11 +++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) 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(); -- 2.30.2