Bugzilla – Attachment 191331 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.60 KB, created by
David Cook
on 2026-01-13 01:52:37 UTC
(
hide
)
Description:
Bug 30261: Render opac 404 for opac/tracklinks.pl
Filename:
MIME Type:
Creator:
David Cook
Created:
2026-01-13 01:52:37 UTC
Size:
2.60 KB
patch
obsolete
>From 7c5c9b4541c09848f2d798aaf6c0fc929ba8a4c7 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! > >Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> > >Passes all tests. No unexpected behaviour could be identified. >--- > 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 669b3e6b577..b45d49b523a 100644 >--- a/C4/Output.pm >+++ b/C4/Output.pm >@@ -391,12 +391,14 @@ Missing POD for output_error. > =cut > > 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 471615522a6..3445ea4feda 100755 >--- a/opac/tracklinks.pl >+++ b/opac/tracklinks.pl >@@ -37,7 +37,7 @@ $uri =~ s/^\s+|\s+$//g if $uri; # trim > > 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( { trackingmethod => $tracking_method } ); >@@ -85,5 +85,5 @@ if ( $uri && ( $biblionumber || $itemnumber ) ) { > } > } > >-output_error( $cgi, '404' ); >+output_error( $cgi, '404', { interface => 'opac' } ); > exit; >-- >2.39.5
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
| 191331