Bugzilla – Attachment 168101 Details for
Bug 36891
Restore returning 404 from svc/bib when the bib number doesn't exist
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36891: Restore returning 404 from svc/bib when the bib number doesn't exist
Bug-36891-Restore-returning-404-from-svcbib-when-t.patch (text/plain), 2.24 KB, created by
Nick Clemens (kidclamp)
on 2024-06-25 21:24:38 UTC
(
hide
)
Description:
Bug 36891: Restore returning 404 from svc/bib when the bib number doesn't exist
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-06-25 21:24:38 UTC
Size:
2.24 KB
patch
obsolete
>From 45349acd1a6bfb2b236979c383815513eec771cb Mon Sep 17 00:00:00 2001 >From: Phil Ringnalda <phil@chetcolibrary.org> >Date: Thu, 16 May 2024 17:01:54 -0700 >Subject: [PATCH] Bug 36891: Restore returning 404 from svc/bib when the bib > number doesn't exist > >Changing from GetMarcBiblio to Biblios->find plus metadata->record lost the >way that svc/bib used to return 404 when the bib number wasn't found. This >patch restores that by checking for undef after the Biblios->find step. > >Test plan: >1. Load e.g. http://127.0.0.1:8081/cgi-bin/koha/svc/bib/289 which returns an > XML bib record >2. Load http://127.0.0.1:8081/cgi-bin/koha/svc/bib/99999999 and get a 500 error >2. Appply patch, restart_all >4. Reload http://127.0.0.1:8081/cgi-bin/koha/svc/bib/289 and get the bib again >5. Reload http://127.0.0.1:8081/cgi-bin/koha/svc/bib/99999999 and get a 404 > >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > svc/bib | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > >diff --git a/svc/bib b/svc/bib >index 53e6fc753ed..da96e01f9ab 100755 >--- a/svc/bib >+++ b/svc/bib >@@ -70,14 +70,14 @@ sub fetch_bib { > my $record; > my $exception; > my $invalid_metadata = 0; >- eval { $record = $biblio->metadata->record( { embed_items => scalar $query->param('items') } ) }; >- if ($@) { >- $exception = $@; >- $exception->rethrow unless ( $exception->isa('Koha::Exceptions::Metadata::Invalid') ); >- $record = $biblio->metadata->record_strip_nonxml( { embed_items => scalar $query->param('items') } ); >- $invalid_metadata = 1; >- } >- if ( defined $record ) { >+ if ( defined $biblio ) { >+ eval { $record = $biblio->metadata->record( { embed_items => scalar $query->param('items') } ) }; >+ if ($@) { >+ $exception = $@; >+ $exception->rethrow unless ( $exception->isa('Koha::Exceptions::Metadata::Invalid') ); >+ $record = $biblio->metadata->record_strip_nonxml( { embed_items => scalar $query->param('items') } ); >+ $invalid_metadata = 1; >+ } > print $query->header( -type => 'text/xml', -charset => 'utf-8', -invalid_metadata => $invalid_metadata ); > print $record->as_xml_record(); > } else { >-- >2.39.2
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 36891
:
166858
|
166914
|
166923
| 168101