[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
Thu Jun 22 18:20:02 CEST 2023


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

Sam Lau <samalau at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #152550|0                           |1
        is obsolete|                            |

--- Comment #4 from Sam Lau <samalau at gmail.com> ---
Created attachment 152573
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=152573&action=edit
Bug 33270: Warn errors but catch exceptions when encountering record issues in
OAI-PMH

This patch alters the OAI code to attempt to load a badly encoded record by
removing non XML characters. OAI harvests are used to keep external catalogs or
display layers in sync with Koha. We should not break this connection when
there is a bad record, but should allow the harvest to complete - warn the
errors, and rely on Koha warnings/errors/tools to idnetify and fix the problem
on the Koha side

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

Signed-off-by: Sam Lau <samalau at gmail.com>

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


More information about the Koha-bugs mailing list