https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39621 Bug ID: 39621 Summary: invalid marcxml records can be imported Change sponsored?: --- Product: Koha Version: 24.11 Hardware: All OS: Linux Status: NEW Severity: normal Priority: P5 - low Component: MARC Bibliographic record staging/import Assignee: koha-bugs@lists.koha-community.org Reporter: furtadojaden@gmail.com QA Contact: testopia@bugs.koha-community.org Created attachment 180891 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=180891&action=edit Invalid marcxml that can be staged for imports but which crashes when attempted to be imported into a catalog Hello, This is my first bug report for any OSS. Sorry for any mistakes that I might make given my inexperience :) Issue: The issue is that it is possible to import invalid marcxml files in Koha, which then causes an import of this staged record into the catalog to fail. I have attached an example marcxml record for reference, that can be staged in koha, but which is invlaid. Below is the snippet that causes the issue, i.e. notice the tags 001 and <subfield code="p"> M18325</subfield>, have a space before the data M18325. --------------------- <?xml version="1.0" ?> <collection xmlns="http://www.loc.gov/MARC21/slim"> <record> <leader>00000nam a2200000 a 4500</leader> <controlfield tag="001"> M18325</controlfield> ... ... <datafield tag="952" ind1=" " ind2=" "> ... ... <subfield code="p"> M18325</subfield> ... ... </datafield> ... ... ---------------------- Proposed fix: When checking the validity of an imported XML file, a check needs to be added to ensure that this case of trailing and leading spaces in record data fields is handled at the time of staging XML records. I would also suggest that errors should be logged/shown on the frontend, when an import into catalog fails, since it took me a while to dig through a batch of over 5000 records before I could find the cause of the crash. I went through worker and koha error logs but found nothing. Not sure if I was looking in the wrong place. P.S.: I see that there was a previous discussion: Bug 35104 - We should warn when attempting to save MARC records that contain characters invalid in XML However, I am not sure if this bug falls under that or not. Thanks for the help. Regards, Jaden -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.