Bug #6506
closedPassing a buffer as the sourceText to SaxonJS.transform gives a nasty error
50%
Description
You're supposed to pass a string, but if you pass a buffer it crashes out with a really nasty error message. We should accept a buffer and/or test that it's a string and give a reasonable error message.
Updated by Norm Tovey-Walsh 3 months ago
- Status changed from New to Resolved
- Applies to JS Branch 2, Trunk added
- Fix Committed on JS Branch 2, Trunk added
If a user passes a Buffer
(as one might get from fs.read...
) as a text input, convert the buffer to a string.
(I think this is less likely in the browser where there's no obvious file I/O mechanism to get a buffer, so I haven't tried to address it in the browser platform.)
Updated by Debbie Lockett about 1 month ago
The fix cherry-picked and pushed to the saxonjs2 branch was broken. It relies on new code only on the main branch (i.e. the decodeBuffer
function in NodeJSPlatform.js) which is part of extensive changes in the area.
For SaxonJS 2, I think we should just improve the error message if the sourceText
option for SaxonJS.transform
is not a string.
I have committed changes in the code and updated the test (nodejs/iss6506) on the saxonjs2
branch accordingly.
Updated by Debbie Lockett about 1 month ago
- % Done changed from 0 to 50
Error message fix applied in the SaxonJS 2.7 maintenance release.
Full bug fix will be applied in SaxonJS 3.0.
Please register to edit this issue
Also available in: Atom PDF Tracking page