Bug #6506
closedPassing a buffer as the sourceText to SaxonJS.transform gives a nasty error
100%
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 4 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 2 months 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 2 months 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.
Updated by Debbie Lockett 8 days ago
- Status changed from Resolved to Closed
- % Done changed from 50 to 100
- Fixed in JS Release set to SaxonJS 3.0
Bug fix applied in the SaxonJS 3.0.0-beta1 preview release.
Please register to edit this issue
Also available in: Atom PDF Tracking page