[Koha-bugs] [Bug 33270] OAI-PMH should not die on record errors

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Jun 23 18:50:35 CEST 2023


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33270

--- Comment #9 from Nick Clemens <nick at bywatersolutions.com> ---
Created attachment 152650
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=152650&action=edit
Bug 33270: Attempt to recover from invalid metadata exception

This patch uses the new record_strip_nonxml routine to attempt to display
the record when it contains invalid characters

Rather than silently strippg these, we warn in the logs, then add an 'about'
container to the response. It is displayed nicely in the web view or sent as
"INVALID_METADATA" in
the xml response

The 'error' codes for OAI seem to be at the request level, and the offered
codes don't have a match
for a bad record. Adding the about when we can recover seems the most generous
response

To test:
Test plan, assumes using KTD default data - otherwise you need to find and
import a record with encoding issues:
 1 - Enable OAI-PMH system preference
 2 - Browse to:
   
http://localhost:8080/cgi-bin/koha/oai.pl?verb=ListRecords&resumptionToken=marcxml/350////0/0/352
 3 - 500 error:
    Invalid data, cannot decode metadata object (biblio_metadata.id=368,
biblionumber=369, format=marcxml, schema=MARC21, decoding_error=':8: parser
error : PCDATA invalid Char value 31...
 4 - Apply patch, restart all
 5 - Reload the page
 6 - It loads!
 7 - Click 'Metadata' for record 369 - it succeeds!
 8 - Check the logs - confirm you see a warning of the record problem
 9 - Confirm 369 has an about section
10 - Check the individul 'GetRecord' response as well
   
http://localhost:8080/cgi-bin/koha/oai.pl?verb=GetRecord&metadataPrefix=oai_dc&identifier=KOHA-OAI-TEST:369

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list