Bugzilla – Attachment 166858 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: Naive attempt to fix svc/bib to return 404 when bib number not found
Bug-36891-Naive-attempt-to-fix-svcbib-to-return-40.patch (text/plain), 2.21 KB, created by
Phil Ringnalda
on 2024-05-17 00:22:52 UTC
(
hide
)
Description:
Bug 36891: Naive attempt to fix svc/bib to return 404 when bib number not found
Filename:
MIME Type:
Creator:
Phil Ringnalda
Created:
2024-05-17 00:22:52 UTC
Size:
2.21 KB
patch
obsolete
>From c94a2b89baca6d52611489c053dce4cf1f170159 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: Naive attempt to fix svc/bib to return 404 when > bib number not found > >But of course it can't be simple. After just adding if ( defined $biblio ) and >reindenting and tidying what I indented, I'm told that I made two more untidy >lines. > >And there's a bad smell around the "if ( defined $record )" since I don't see >how it could be false, because $biblio->metadata->record doesn't return undef. >But maybe I'm missing something. >--- > svc/bib | 22 ++++++++++++---------- > 1 file changed, 12 insertions(+), 10 deletions(-) > >diff --git a/svc/bib b/svc/bib >index 53e6fc753e..3e786f2191 100755 >--- a/svc/bib >+++ b/svc/bib >@@ -70,16 +70,18 @@ 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 ) { >- print $query->header( -type => 'text/xml', -charset => 'utf-8', -invalid_metadata => $invalid_metadata ); >- print $record->as_xml_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; >+ } >+ if ( defined $record ) { >+ print $query->header( -type => 'text/xml', -charset => 'utf-8', -invalid_metadata => $invalid_metadata ); >+ print $record->as_xml_record(); >+ } > } else { > print $query->header( -type => 'text/xml', -status => '404 Not Found' ); > } >-- >2.44.0
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