From 16d6aafbcd95f22764b95f8b6955f3b1dfea3ed0 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 21 Jan 2021 12:20:03 +0100 Subject: [PATCH] Bug 22070: Try to fix encoding and escaping issue on browse result Pretty sure this does not work but in my tests it seems to fix the problem. Note that if there are several pages, the next link won't appear if you are on the last result of the first page. I don't understand why this code is so complicated, couldn't we port what we have on the staff interface (browser.js)? Signed-off-by: Katrin Fischer --- opac/opac-detail.pl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 000eac3a51..f4b60ed721 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -203,7 +203,7 @@ if ($OpacBrowseResults) { my $session = get_session($query->cookie("CGISESSID")); my %paging = (previous => {}, next => {}); if ($session->param('busc')) { - use URI::Escape qw( uri_escape_utf8 uri_unescape ); + use C4::Search; # Rebuild the string to store on session # param value is URI encoded and params separator is HTML encode (&) @@ -217,14 +217,14 @@ if ($session->param('busc')) { if ($_ =~ /^(?:query|listBiblios|newlistBiblios|query_type|simple_query|total|offset|offsetSearch|next|previous|count|expand|scan)/) { if (defined($arrParamsBusc->{$_})) { $pasarParams .= '&' if ($j); - $pasarParams .= $_ . '=' . Encode::decode('UTF-8', uri_escape_utf8( $arrParamsBusc->{$_} )); + $pasarParams .= $_ . '=' . $arrParamsBusc->{$_}; $j++; } } else { for my $value (@{$arrParamsBusc->{$_}}) { next if !defined($value); $pasarParams .= '&' if ($j); - $pasarParams .= $_ . '=' . Encode::decode('UTF-8', uri_escape_utf8($value)); + $pasarParams .= $_ . '=' . $value; $j++; } } @@ -291,12 +291,12 @@ if ($session->param('busc')) { for (@arrBusc) { ($key, $value) = split(/=/, $_, 2); if ($key =~ /^(?:query|listBiblios|newlistBiblios|query_type|simple_query|next|previous|total|offset|offsetSearch|count|expand|scan)/) { - $arrParamsBusc{$key} = uri_unescape($value); + $arrParamsBusc{$key} = $value; } else { unless (exists($arrParamsBusc{$key})) { $arrParamsBusc{$key} = []; } - push @{$arrParamsBusc{$key}}, uri_unescape($value); + push @{$arrParamsBusc{$key}}, $value; } } my $searchAgain = 0; -- 2.30.2