Bugzilla – Attachment 107744 Details for
Bug 26127
When reporting an Error from the OPAC, the URL does not display
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26127: local_referer should not compare with OPACBaseURL case insensitive
Bug-26127-localreferer-should-not-compare-with-OPA.patch (text/plain), 2.25 KB, created by
Jonathan Druart
on 2020-08-04 11:26:59 UTC
(
hide
)
Description:
Bug 26127: local_referer should not compare with OPACBaseURL case insensitive
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-08-04 11:26:59 UTC
Size:
2.25 KB
patch
obsolete
>From fcb2c5de1e1d7fb77e9e18bf350e72f185d1e583 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 3 Aug 2020 15:07:24 +0200 >Subject: [PATCH] Bug 26127: local_referer should not compare with OPACBaseURL > case insensitive > >In our test data we have OPACBaseURL that is filled with http://kohadev.myDNSname.org:8080, >but the CGI referer in local_referer is lowercase >We should compare it without case sensitivity > >Test plan: >- Use koha-testing-docker >- Notice the value of OPACBaseURL >=> http://kohadev.myDNSname.org:8080 >- Use the "reports a problem" feature at the OPAC >- Notice that the "Problem found on page" is correctly filled with the >referer >--- > Koha/Util/Navigation.pm | 2 +- > t/Koha/Util/Navigation.t | 6 +++++- > 2 files changed, 6 insertions(+), 2 deletions(-) > >diff --git a/Koha/Util/Navigation.pm b/Koha/Util/Navigation.pm >index 6f9b304b5c..75bde71fa1 100644 >--- a/Koha/Util/Navigation.pm >+++ b/Koha/Util/Navigation.pm >@@ -59,7 +59,7 @@ sub local_referer { > > # Try ..BaseURL first, otherwise use CGI::url > if( $base ) { >- if( substr($referer, 0, length($base)) eq $base && >+ if( $referer =~ m|^\Q$base\E|i && > $referer =~ /\/cgi-bin\/koha\// ) > { > $rv = substr( $referer, length($base) ); >diff --git a/t/Koha/Util/Navigation.t b/t/Koha/Util/Navigation.t >index 466f296e60..9ff50ea238 100644 >--- a/t/Koha/Util/Navigation.t >+++ b/t/Koha/Util/Navigation.t >@@ -7,7 +7,7 @@ use t::lib::Mocks; > use Koha::Util::Navigation; > > subtest 'Tests for local_referer' => sub { >- plan tests => 10; >+ plan tests => 11; > > my ( $referer, $base ); > my $cgi = Test::MockObject->new; >@@ -26,6 +26,10 @@ subtest 'Tests for local_referer' => sub { > $referer = 'https://koha.nl/custom/stuff'; > is( Koha::Util::Navigation::local_referer($cgi), '/', 'custom url' ); > >+ t::lib::Mocks::mock_preference('OPACBaseURL', 'http://kohadev.myDNSname.org:8080'); >+ $referer = "http://kohadev.mydnsname.org:8080$search"; >+ is( Koha::Util::Navigation::local_referer($cgi), $search, 'local_referer is comparing $OPACBaseURL case insensitive' ); >+ > # trailing backslash > t::lib::Mocks::mock_preference('OPACBaseURL', 'http://koha.nl/' ); > $referer = "http://koha.nl$search"; >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26127
:
107700
|
107704
|
107710
|
107744
|
108094
|
108317