https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44069 --- Comment #1 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 211483 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211483&action=edit Bug 44069: Fix svc/bib for recoverable and unrecoverable records Koha::Biblio::Metadata->record() now repairs recoverable MARCXML faults on read and reports them through object_messages, and record_strip_nonxml() was removed. svc/bib still called the removed method when metadata_record() threw Koha::Exceptions::Metadata::Invalid, so unrecoverable records died with a missing-method error instead of returning a proper error. Recoverable records never reached that branch, so the invalid_metadata header was never set and the advanced cataloguing editor no longer warned about encoding issues. This change drops the record_strip_nonxml call and returns a 500 with an XML error body for unrecoverable records. The invalid_metadata header is now set from $biblio->metadata->object_messages, as Koha::OAI::Server::Repository->get_biblio_marcxml does. A new regression test, t/db_dependent/svc/bib.t, covers valid, recoverable, unrecoverable and unknown records. To test: 1. Apply the patch. 2. Create a record and store MARCXML with a control character (chr(31)) in a subfield directly in biblio_metadata. 3. Request /cgi-bin/koha/svc/bib/<biblionumber>. Confirm the response carries "Invalid-metadata: 1" and the repaired record. 4. Open the record in the advanced cataloguing editor and confirm the "Record had encoding issues" alert is shown. 5. Store truncated XML in biblio_metadata and request the same URL. Confirm a 500 with an XML error body, not a missing-method error. 6. Run: prove t/db_dependent/svc/bib.t Sponsored-by: OpenFifth Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes.