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

            Bug ID: 43022
           Summary: Biblio create/update REST endpoints return a raw 500
                    for undecodable MARC
   Initiative type: ---
        Sponsorship ---
            status:
           Product: Koha
           Version: Main
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P5 - low
         Component: REST API
          Assignee: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]
                CC: [email protected]
        Depends on: 35104
  Target Milestone: ---

Koha::REST::V1::Biblios's create and update actions call
MARC::Record->new_from_xml / new_from_mij_structure / new_from_usmarc
directly on the request body with no eval (Koha/REST/V1/Biblios.pm, the
create and update methods). A malformed MARCXML/MARC-in-JSON/ISO2709 payload
from an API client currently produces a raw 500 response with a Perl
exception message in the body, instead of a clean 400-style validation
error.

Found while auditing other places in the codebase that ingest
externally-sourced MARC data, prompted by bug 35104.

Test plan:
1. POST to /api/v1/biblios (or PUT to update an existing one) with a
   Content-Type matching one of the supported MARC formats, and a body that
   cannot be decoded (e.g. truncated/invalid MARCXML).
2. Before a fix: the response is a 500 with a raw exception/stack trace.
3. After a fix: the response is a 400-class error with a clear message
   describing the decoding problem.


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35104
[Bug 35104] We should warn when attempting to save MARC records that contain
characters invalid in XML
-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to