Bug 35181: Don't pass undef to header

It seems passing an undef value causes the headers to be malformed.

To test:
1 - Visit http://localhost:8081/cgi-bin/koha/svc/bib/303
2 - Note 'Invalid-metadata' at top of page, as well as other headers
3 - Apply patch, restart all
4 - Visit http://localhost:8081/cgi-bin/koha/svc/bib/303
5 - Page should now appear as xml
6 - Edit record 303, or any record with valid metadata in the advanced cataloging editor
7 - Confirm there is no error or alert
8 - Edit record 369 in the advanced cataloging editor
9 - Confirm there is an alert

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Nick Clemens 2023-11-02 10:56:30 +00:00 committed by Tomas Cohen Arazi
parent 1ff0181227
commit 38e95c7769
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
2 changed files with 2 additions and 2 deletions

View file

@ -108,7 +108,7 @@ define( [ '/cgi-bin/koha/svc/cataloguing/framework?frameworkcode=&callback=defin
'/cgi-bin/koha/svc/bib/'+ id '/cgi-bin/koha/svc/bib/'+ id
).done( function( metadata, status, xhr ) { ).done( function( metadata, status, xhr ) {
let encoding_issues = xhr.getResponseHeader('invalid-metadata'); let encoding_issues = xhr.getResponseHeader('invalid-metadata');
if( encoding_issues ){ if( encoding_issues > 0 ){
humanMsg.displayAlert( _("Record had encoding issues, please switch to the basic editor to view details") ); humanMsg.displayAlert( _("Record had encoding issues, please switch to the basic editor to view details") );
} }
$.get( $.get(

View file

@ -69,7 +69,7 @@ sub fetch_bib {
my $biblio = Koha::Biblios->find( $biblionumber ); my $biblio = Koha::Biblios->find( $biblionumber );
my $record; my $record;
my $exception; my $exception;
my $invalid_metadata; my $invalid_metadata = 0;
eval { $record = $biblio->metadata->record( { embed_items => scalar $query->param('items') } ) }; eval { $record = $biblio->metadata->record( { embed_items => scalar $query->param('items') } ) };
if ($@) { if ($@) {
$exception = $@; $exception = $@;