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

--- Comment #2 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 211487
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211487&action=edit
Bug 43021: Skip undecodable Z39.50/SRU results and staged records

A single malformed record from a Z39.50/SRU server could break the
whole cataloguing search, and an undecodable staged record could break
the breeding preview.

C4::Breeding::_handle_one_result decoded SRU results with no eval, so
one bad record aborted the results page. The non-SRU branch and the
XSLT re-decode in _do_xslt_proc had the same problem, and an empty
record from a failed MARC parse was silently stored as a result. Now
an undecodable result is logged with Koha::Logger, skipped, and
reported as a per-result message ("could not be decoded and was
skipped"), while the other results still render.

MARCfindbreeding in cataloguing/addbiblio.pl had the same unguarded
new_from_usmarc call. A staged record that cannot be decoded is now
logged and the addbiblio page shows a clear error instead of dying.

To test:
1. Configure a Z39.50 or SRU server in Administration > Z39.50/SRU
   servers that returns at least one record with broken MARC, or
   simulate it by feeding a non-MARC blob through C4::Breeding.
2. Go to Cataloguing > Z39.50/SRU search and search that server.
3. Before this patch: the results page errors out.
4. After this patch: the page still shows the other results, and an
   alert lists the skipped record as "could not be decoded and was
   skipped". A line is written to the Koha log.
5. Stage a file containing an undecodable record under Tools > Stage
   MARC records for import, then open that staged record from the
   breeding preview (cataloguing/addbiblio.pl?breedingid=...).
6. Before this patch: the page errors out.
7. After this patch: the page shows the "could not be decoded" alert
   and no crash.
8. Run prove t/db_dependent/Breeding.t. All tests pass.

Sponsored-by: OpenFifth
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to