balena-io / pensieve

A tool for managing and viewing structured documents, backed by the power of git
8 stars 5 forks source link

YAML becomes corrupted if multiline text starts with indentation #281

Open LucianBuzzo opened 6 years ago

LucianBuzzo commented 6 years ago

https://www.flowdock.com/app/rulemotion/resin-frontend/threads/DwDNDfVOctCNYdN9IHV6_S-1pLZ

LucianBuzzo commented 6 years ago

From my investigations I've found that js-yaml safely handles leading spaces in multiline strings.

jsyaml.safeDump({ s: "       \ntest"})

yields

s: |2-

  test

Which correctly handles the indentation using the number hinting.

I'm not sure how the malformed yaml was inserted in the first place though