[Bug 19655] New: To.json doesn' t escape newlines which can create invalid JSON
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19655 Bug ID: 19655 Summary: To.json doesn't escape newlines which can create invalid JSON Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: kyle@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org JSON does not allow real line-breaks. If a field contains them and they are not escaped, a JSON parser will be unable to convert the stringified JSON back into an object. This is clearly exemplified by the guarantor search, where a multi-line note on the guarantor's record will break the ability to select that guarantor. -- 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=19655 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |critical Assignee|koha-bugs@lists.koha-commun |kyle@bywatersolutions.com |ity.org | -- 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=19655 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19655 --- Comment #1 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 69235 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=69235&action=edit Bug 19655 - To.json doesn't escape newlines which can create invalid JSON JSON does not allow real line-breaks. If a field contains them and they are not escaped, a JSON parser will be unable to convert the stringified JSON back into an object. This is clearly exemplified by the guarantor search, where a multi-line note on the guarantor's record will break the ability to select that guarantor. Test Plan: 1) Create Patron A with a "Circulation note" that has multiple lines in it 2) Create Patron B 3) Attempt to set Patron A to be the guarantor for Patron B 4) Note selecting the patron does nothing 5) Apply this patch 6) Repeat step 3 7) Selecting the guarantor now works! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19655 Simon Pouchol <simon.pouchol@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #69235|0 |1 is obsolete| | --- Comment #2 from Simon Pouchol <simon.pouchol@biblibre.com> --- Created attachment 69244 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=69244&action=edit Bug 19655 - To.json doesn't escape newlines which can create invalid JSON JSON does not allow real line-breaks. If a field contains them and they are not escaped, a JSON parser will be unable to convert the stringified JSON back into an object. This is clearly exemplified by the guarantor search, where a multi-line note on the guarantor's record will break the ability to select that guarantor. Test Plan: 1) Create Patron A with a "Circulation note" that has multiple lines in it 2) Create Patron B 3) Attempt to set Patron A to be the guarantor for Patron B 4) Note selecting the patron does nothing 5) Apply this patch 6) Repeat step 3 7) Selecting the guarantor now works! Signed-off-by: Simon Pouchol <simon.pouchol@biblibre.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19655 Simon Pouchol <simon.pouchol@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |simon.pouchol@biblibre.com Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19655 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA Patch complexity|--- |Trivial patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19655 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #69244|0 |1 is obsolete| | --- Comment #3 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 69326 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=69326&action=edit Bug 19655 - To.json doesn't escape newlines which can create invalid JSON JSON does not allow real line-breaks. If a field contains them and they are not escaped, a JSON parser will be unable to convert the stringified JSON back into an object. This is clearly exemplified by the guarantor search, where a multi-line note on the guarantor's record will break the ability to select that guarantor. Test Plan: 1) Create Patron A with a "Circulation note" that has multiple lines in it 2) Create Patron B 3) Attempt to set Patron A to be the guarantor for Patron B 4) Note selecting the patron does nothing 5) Apply this patch 6) Repeat step 3 7) Selecting the guarantor now works! Signed-off-by: Simon Pouchol <simon.pouchol@biblibre.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19655 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |m.de.rooy@rijksmuseum.nl |y.org | CC| |m.de.rooy@rijksmuseum.nl -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19655 --- Comment #4 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 69346 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=69346&action=edit Bug 19655: Add tests -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19655 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@bugs.koha-c | |ommunity.org --- Comment #5 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- I am not sure it is the best way to fix it. 1. We may encounter issues later using To.json on other values that use escaped strings (ok we will update the code to make it works) 2. Maybe we should replace all \\ with \\\\ I will push as it and adapt later if needed. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19655 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master --- Comment #6 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Pushed to master for 17.11, 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=19655 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=19721 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19655 Fridolin SOMERS <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |Pushed to Stable CC| |fridolin.somers@biblibre.co | |m --- Comment #7 from Fridolin SOMERS <fridolin.somers@biblibre.com> --- Poushed to 17.05.x, will be in v17.05.07 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19655 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |chris@bigballofwax.co.nz --- Comment #8 from Chris Cormack <chris@bigballofwax.co.nz> --- Pushed to 16.11.x will be in 16.11.15 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19655 --- Comment #9 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- (In reply to Chris Cormack from comment #8)
Pushed to 16.11.x will be in 16.11.15
This patch breaks tests: https://jenkins.koha-community.org/job/Koha_16.11_D8/89/ # Failed test 'No tests run for subtest "json"' # at t/db_dependent/Template/Plugin/To.t line 44. Can't locate object method "build_object" via package "t::lib::TestBuilder" at t/db_dependent/Template/Plugin/To.t line 32. # Looks like your test exited with 255 just after 1. [09:41:40] t/db_dependent/Template/Plugin/To.t The build_object method of TestBuilder has been added by bug 18182, which is not in 16.11.x You should use ->build instead. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19655 --- Comment #10 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 69732 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=69732&action=edit Bug 19655: Use ->build instead of build_object in 16.11.x The build_object method of TestBuilder has been added by bug 18182, which is not in 16.11.x Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19655 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #69732|0 |1 is obsolete| | --- Comment #11 from Chris Cormack <chris@bigballofwax.co.nz> --- Created attachment 69806 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=69806&action=edit Bug 19655: Use ->build instead of build_object in 16.11.x The build_object method of TestBuilder has been added by bug 18182, which is not in 16.11.x Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19655 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |15734 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15734 [Bug 15734] Audio Alerts broken -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org