Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Strings of length >= 80 with a single non-space character serialize to invalid YAML #105

Closed
quantimnot opened this issue Jan 21, 2022 · 2 comments

Comments

@quantimnot
Copy link
Contributor

import yaml, strutils
var str = dump(repeat("00 ", 27))
echo str # valid
load(str, str) # works
str = dump(repeat("0 ", 40))
echo str # invalid
load(str, str) # fails

# output
#
# %YAML 1.2
# %TAG !n! tag:nimyaml.org,2016:
# ---
# !!str >-
#   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
# %YAML 1.2
# %TAG !n! tag:nimyaml.org,2016:
# ---
# !!str >- 0
#   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
# [NimYAML] Error in file serialization.nim at line 1355:
# Unexpected exception: LexerError
# … stacktrace [YamlStreamError: Illegal character after block scalar header: "0"]
@flyx flyx closed this as completed in 89e18ce Jan 22, 2022
@flyx
Copy link
Owner

flyx commented Jan 22, 2022

Pretty sure this fixes it, but I currently don't have a working Nim dev env so please test and report back!

(you can nimble install yaml#head to get this fix)

@quantimnot
Copy link
Contributor Author

Thank you! I was juuust getting into that proc :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants