Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Wrong column on duplicated mapping key exception #452

Closed
hughsw opened this issue Oct 22, 2018 · 1 comment
Closed

Wrong column on duplicated mapping key exception #452

hughsw opened this issue Oct 22, 2018 · 1 comment

Comments

@hughsw
Copy link

hughsw commented Oct 22, 2018

On this file containing 164 bytes:

VendorContact:
  fields:
    EntityContact: belongsTo

VendorContact:
  fields:
    ContactPerson: belongsTo

This exception:

YAMLException: duplicated mapping key at line 5, column -53:
    VendorContact:
    ^

Column should be 1.

Column calculation appears to be based on offset in some buffer (in this case the distance to the end of the file) rather than the parser position, modulo sign and off-by-one:
Bytes from start of duplicate to end of file: 54

safeLoad()
"js-yaml": "3.12.0",

See also #243 for links to a related, but fixed issue.

@rlidwka
Copy link
Member

rlidwka commented Dec 11, 2020

Fixed in b1cc0e9 (currently in dev branch, gonna be released as js-yaml 4 later).

@rlidwka rlidwka closed this as completed Dec 11, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants