Closed
Description
Hello,
I'm using js-yaml in a code editor that supports json and yaml user input and then transforms the content (if it is valid) into javascript objects for further manipulation.
I've encountered the following bug: If an array contains an extra comma ,
, instead of throwing an exception for invalid yaml or json, the parser transforms the value into null
. Although I include several other options, this is the simplest case in which the error occurs.
Code snippet:
var yaml = require('js-yaml');
var result = yaml.safeLoad('[,,]');
Expected:
YAMLException is thrown
Actual:
result === [null, null]
Activity
puzrin commentedon Jan 24, 2017
Seems to be a bug. libyaml-based parsers return error
@dervus ?
Disallow completely empty nodes in flow collections
rlidwka commentedon Dec 11, 2020
Fixed in adfee17 (currently in dev branch, gonna be released as js-yaml 4 later).
11 remaining items