[Bug 20540] New: TransformHtmlToXml can duplicate </datafield>
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20540 Bug ID: 20540 Summary: TransformHtmlToXml can duplicate </datafield> Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Cataloging Assignee: koha-bugs@lists.koha-community.org Reporter: jonathan.druart@bugs.koha-community.org QA Contact: testopia@bugs.koha-community.org CC: m.de.rooy@rijksmuseum.nl This bug has been found during testing bug 19289. In some conditions C4::Biblio::TransformHtmlToXml will generate a malformed XML structure. The last </datafield> can be duplicated. For instance, if a call like: my $xml = TransformHtmlToXml( \@tags, \@subfields, \@field_values ); with the last value of @field_values is empty, it will return: <?xml version="1.0" encoding="UTF-8"?> <collection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd" xmlns="http://www.loc.gov/MARC21/slim"> <record> <datafield2 tag="020" ind1=" " ind2=" "> <subfield code="a">l</subfield> </datafield> <datafield1 tag="100" ind1=" " ind2=" "> <subfield code="a">k</subfield> </datafield> <datafield1 tag="245" ind1=" " ind2=" "> <subfield code="a">k</subfield> </datafield> <datafield1 tag="250" ind1=" " ind2=" "> <subfield code="a">k</subfield> </datafield> <datafield1 tag="260" ind1=" " ind2=" "> <subfield code="b">k</subfield> <subfield code="c">k</subfield> </datafield> </datafield> </record> </collection> Which will result later in the following error: :23: parser error : Opening and ending tag mismatch: record line 6 and datafield </datafield> ^ :24: parser error : Opening and ending tag mismatch: collection line 2 and record </record> ^ :25: parser error : Extra content at the end of the document </collection> -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20540 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20540 --- Comment #1 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 73801 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73801&action=edit Bug 20540: Fix TransformHtmlToXml if last tag is empty This bug has been found during testing bug 19289. In some conditions C4::Biblio::TransformHtmlToXml will generate a malformed XML structure. The last </datafield> can be duplicated. For instance, if a call like: my $xml = TransformHtmlToXml( \@tags, \@subfields, \@field_values ); with the last value of @field_values is empty, it will return: <?xml version="1.0" encoding="UTF-8"?> <collection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd" xmlns="http://www.loc.gov/MARC21/slim"> <record> <datafield2 tag="020" ind1=" " ind2=" "> <subfield code="a">l</subfield> </datafield> <datafield1 tag="100" ind1=" " ind2=" "> <subfield code="a">k</subfield> </datafield> <datafield1 tag="245" ind1=" " ind2=" "> <subfield code="a">k</subfield> </datafield> <datafield1 tag="250" ind1=" " ind2=" "> <subfield code="a">k</subfield> </datafield> <datafield1 tag="260" ind1=" " ind2=" "> <subfield code="b">k</subfield> <subfield code="c">k</subfield> </datafield> </datafield> </record> </collection> Which will result later in the following error: :23: parser error : Opening and ending tag mismatch: record line 6 and datafield </datafield> ^ :24: parser error : Opening and ending tag mismatch: collection line 2 and record </record> ^ :25: parser error : Extra content at the end of the document </collection> Test plan: You can test it along with bug 19289 and confirm that it fixes the problem raised on bug 19289 comment 30 -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20540 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |19289 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19289 [Bug 19289] Allow configuration of the fields on the 'Catalog details' form in the acquisition baskets -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20540 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20540 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #73801|0 |1 is obsolete| | --- Comment #2 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 73824 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73824&action=edit Bug 20540: Fix TransformHtmlToXml if last tag is empty This bug has been found during testing bug 19289. In some conditions C4::Biblio::TransformHtmlToXml will generate a malformed XML structure. The last </datafield> can be duplicated. For instance, if a call like: my $xml = TransformHtmlToXml( \@tags, \@subfields, \@field_values ); with the last value of @field_values is empty, it will return: <?xml version="1.0" encoding="UTF-8"?> <collection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd" xmlns="http://www.loc.gov/MARC21/slim"> <record> <datafield2 tag="020" ind1=" " ind2=" "> <subfield code="a">l</subfield> </datafield> <datafield1 tag="100" ind1=" " ind2=" "> <subfield code="a">k</subfield> </datafield> <datafield1 tag="245" ind1=" " ind2=" "> <subfield code="a">k</subfield> </datafield> <datafield1 tag="250" ind1=" " ind2=" "> <subfield code="a">k</subfield> </datafield> <datafield1 tag="260" ind1=" " ind2=" "> <subfield code="b">k</subfield> <subfield code="c">k</subfield> </datafield> </datafield> </record> </collection> Which will result later in the following error: :23: parser error : Opening and ending tag mismatch: record line 6 and datafield </datafield> ^ :24: parser error : Opening and ending tag mismatch: collection line 2 and record </record> ^ :25: parser error : Extra content at the end of the document </collection> Test plan: You can test it along with bug 19289 and confirm that it fixes the problem raised on bug 19289 comment 30 -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20540 --- Comment #3 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 73825 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73825&action=edit Bug 20540: (follow-up) Remove debug line -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20540 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |katrin.fischer@bsz-bw.de Assignee|koha-bugs@lists.koha-commun |jonathan.druart@bugs.koha-c |ity.org |ommunity.org -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20540 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #73824|0 |1 is obsolete| | --- Comment #4 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 73914 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73914&action=edit Bug 20540: Fix TransformHtmlToXml if last tag is empty This bug has been found during testing bug 19289. In some conditions C4::Biblio::TransformHtmlToXml will generate a malformed XML structure. The last </datafield> can be duplicated. For instance, if a call like: my $xml = TransformHtmlToXml( \@tags, \@subfields, \@field_values ); with the last value of @field_values is empty, it will return: <?xml version="1.0" encoding="UTF-8"?> <collection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd" xmlns="http://www.loc.gov/MARC21/slim"> <record> <datafield2 tag="020" ind1=" " ind2=" "> <subfield code="a">l</subfield> </datafield> <datafield1 tag="100" ind1=" " ind2=" "> <subfield code="a">k</subfield> </datafield> <datafield1 tag="245" ind1=" " ind2=" "> <subfield code="a">k</subfield> </datafield> <datafield1 tag="250" ind1=" " ind2=" "> <subfield code="a">k</subfield> </datafield> <datafield1 tag="260" ind1=" " ind2=" "> <subfield code="b">k</subfield> <subfield code="c">k</subfield> </datafield> </datafield> </record> </collection> Which will result later in the following error: :23: parser error : Opening and ending tag mismatch: record line 6 and datafield </datafield> ^ :24: parser error : Opening and ending tag mismatch: collection line 2 and record </record> ^ :25: parser error : Extra content at the end of the document </collection> Test plan: You can test it along with bug 19289 and confirm that it fixes the problem raised on bug 19289 comment 30 Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20540 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #73825|0 |1 is obsolete| | --- Comment #5 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 73915 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73915&action=edit Bug 20540: (follow-up) Remove debug line Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20540 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tomascohen@gmail.com Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20540 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |tomascohen@gmail.com |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20540 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|unspecified |master --- Comment #6 from Tomás Cohen Arazi <tomascohen@gmail.com> --- I picked the tests this bug introduces and can confirm the tests fail without the patches, and pass with it. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20540 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master --- Comment #7 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Pushed to master for 18.05, thanks to everybody involved! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20540 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|TransformHtmlToXml can |TransformHtmlToXml can |duplicate </datafield> |duplicate the datafield | |close tag -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20540 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nick@bywatersolutions.com --- Comment #8 from Nick Clemens <nick@bywatersolutions.com> --- Is this an enh, or a bug? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20540 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |normal --- Comment #9 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- (In reply to Nick Clemens from comment #8)
Is this an enh, or a bug?
It is a bug that was hidden before bug 19289. Without it, it's not necessary to backport it. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20540 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED CC| |martin.renvoize@ptfs-europe | |.com Status|Pushed to Master |RESOLVED -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org