Closed gjtorikian closed 11 years ago
OK, the issue is with PsychHandler, then. (Incidentally, with 0.9.6 I get false
, which is also obviously wrong.) I will investigate.
(And if you were wondering, yes I am smoking crack. There was no version 0.9.6 as of the time I wrote that last comment, which was, incidentally, false anyway.)
Heh. Thanks for getting to it so quickly!
Hmm, I wonder if the test was too naive? New error:
project/vendor/gems/1.9.3/ruby/1.9.1/gems/safe_yaml-0.9.6/lib/safe_yaml.rb:171:in `parse': (/Users/garentorikian/project/vendor/licenses/agpl.txt): mapping values are not allowed in this context at line 57 column 15 (Psych::SyntaxError)
from /Users/garentorikian/project/vendor/gems/1.9.3/ruby/1.9.1/gems/safe_yaml-0.9.6/lib/safe_yaml.rb:171:in `safe_load'
from /Users/garentorikian/project/vendor/gems/1.9.3/ruby/1.9.1/gems/safe_yaml-0.9.6/lib/safe_yaml.rb:184:in `block in safe_load_file'
from /Users/garentorikian/project/vendor/gems/1.9.3/ruby/1.9.1/gems/safe_yaml-0.9.6/lib/safe_yaml.rb:184:in `open'
from /Users/garentorikian/project/vendor/gems/1.9.3/ruby/1.9.1/gems/safe_yaml-0.9.6/lib/safe_yaml.rb:184:in `safe_load_file'
from /Users/garentorikian/project/vendor/gems/1.9.3/ruby/1.9.1/gems/safe_yaml-0.9.6/lib/safe_yaml.rb:151:in `load_file_with_options'
Probably. Am I correct in guessing that this is a file containing some YAML frontmatter, which is otherwise just a lot of non-YAML content?
You are correct.
On Mon, Sep 16, 2013 at 4:10 PM, Dan Tao notifications@github.com wrote:
Probably. Am I correct in guessing that this is a file containing some YAML frontmatter, which is otherwise just a lot of non-YAML content?
— Reply to this email directly or view it on GitHubhttps://github.com/dtao/safe_yaml/issues/48#issuecomment-24552427 .
OK. I'm working out a better solution now.
Just committed a change that should deal with documents like this in a more predictably correct way (basically mimics the way Psych does it internally). Could you try it out (maybe temporarily modify your Gemfile to point to HEAD) and let me know if it seems to work for you? I clearly pushed the last gem version prematurely and don't want to go too crazy with more of that.
:heart: :heart: :heart:
Latest HEAD
works locally for me on the same project.
If I have a .txt file like so:
Calling
data = YAML.load_file(file)
will correctly get me the YAML-as-a-hash indata
. However, after requiring this gem, the following error appears:The workaround for now is to do something like