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> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
1004d47d00
commit
3d1b38b0ad
1 changed files with 8 additions and 8 deletions
2
svc/bib
2
svc/bib
|
@ -70,6 +70,7 @@ sub fetch_bib {
|
|||
my $record;
|
||||
my $exception;
|
||||
my $invalid_metadata = 0;
|
||||
if ( defined $biblio ) {
|
||||
eval { $record = $biblio->metadata->record( { embed_items => scalar $query->param('items') } ) };
|
||||
if ($@) {
|
||||
$exception = $@;
|
||||
|
@ -77,7 +78,6 @@ sub fetch_bib {
|
|||
$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 {
|
||||
|
|
Loading…
Reference in a new issue