Bugzilla – Attachment 131533 Details for
Bug 30261
opac/tracklinks.pl renders 404 incorrectly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30261 - Render opac 404 for opac/tracklinks.pl
Bug-30261---Render-opac-404-for-opactracklinkspl.patch (text/plain), 2.44 KB, created by
David Cook
on 2022-03-10 03:37:22 UTC
(
hide
)
Description:
Bug 30261 - Render opac 404 for opac/tracklinks.pl
Filename:
MIME Type:
Creator:
David Cook
Created:
2022-03-10 03:37:22 UTC
Size:
2.44 KB
patch
obsolete
>From 5a327c4837ceec2c7bb8a90bd00aff6f7b896f29 Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Thu, 10 Mar 2022 03:32:03 +0000 >Subject: [PATCH] Bug 30261 - Render opac 404 for opac/tracklinks.pl > >This patch updates C4::Output::output_error to take >an additional argument which contains an "interface" >parameter, so that opac/tracklinks.pl can generate >an OPAC error instead of an Intranet error. > >Test plan: >0. Apply patch and koha-plack --restart kohadev >1. Go to http://localhost:8081/test.pl >2. Note normal Intranet 404 error >3. Go to http://localhost:8080/cgi-bin/koha/tracklinks.pl?uri=https%3A%2F%2Ftest.com&biblionumber=29 >4. Note normal Opac 404 error >4b. For extra points, note that tracklinks.pl returns a 404 instead of a 302 to the 404.pl page >5. Change 'TrackClicks' syspref to "Track" >6. Go to http://localhost:8080/cgi-bin/koha/tracklinks.pl?uri=https%3A%2F%2Ftest.com&biblionumber=29 >7. Note normal Opac 404 error >7b. For extra points, note that tracklinks.pl returns a 404 instead of a 302 to the 404.pl page >8. Rejoice! >--- > C4/Output.pm | 6 ++++-- > opac/tracklinks.pl | 4 ++-- > 2 files changed, 6 insertions(+), 4 deletions(-) > >diff --git a/C4/Output.pm b/C4/Output.pm >index 8ea7bb51fa..c03c40354d 100644 >--- a/C4/Output.pm >+++ b/C4/Output.pm >@@ -369,12 +369,14 @@ sub output_and_exit { > } > > sub output_error { >- my ( $query, $error ) = @_; >+ my ( $query, $error, $params ) = @_; >+ my $interface = 'intranet'; >+ $interface = 'opac' if ($params && $params->{interface} eq 'opac'); > my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > { > template_name => 'errors/errorpage.tt', > query => $query, >- type => 'intranet', >+ type => $interface, > authnotrequired => 1, > } > ); >diff --git a/opac/tracklinks.pl b/opac/tracklinks.pl >index ab07f033be..ce504c293b 100755 >--- a/opac/tracklinks.pl >+++ b/opac/tracklinks.pl >@@ -35,7 +35,7 @@ my $itemnumber = $cgi->param('itemnumber') || 0; > > my $tracking_method = C4::Context->preference('TrackClicks'); > unless ( $tracking_method ) { >- output_error( $cgi, '404' ); >+ output_error( $cgi, '404', { interface => 'opac' } ); > exit; > } > my $tracker = Koha::Linktracker->new( >@@ -83,5 +83,5 @@ if ($uri && ($biblionumber || $itemnumber) ) { > } > } > >-output_error( $cgi, '404' ); >+output_error( $cgi, '404', { interface => 'opac' } ); > exit; >-- >2.25.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 30261
:
131533
|
134921