Skip to content

YAML.parse() incorrectly splits on --- inside values #25660

@arc-source-coder

Description

@arc-source-coder

What version of Bun is running?

1.3.5+1e86cebd7

What platform is your computer?

Microsoft Windows NT 10.0.26100.0 x64

What steps can reproduce the bug?

Bun splits the output into two objects when unquoted --- is present regardless of position.

const text = `
name: some-text---
description: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
`
let parsed = Bun.YAML.parse(text);
console.log(parsed);

What is the expected behavior?

--- that is part of a scalar value should not be treated as a break.

js-yaml parses it correctly and outputs:

{
  name: "some-text---",
  description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
}

What do you see instead?

The Bun.YAML parser outputs:

[
  {
    name: "some-text",
  }, {
    description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
  }
]

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions