gma / nesta

File Based CMS and Static Site Generator
http://nestacms.com
MIT License
902 stars 122 forks source link

Blank articles crash entire site #44

Closed lilith closed 13 years ago

lilith commented 13 years ago

Nesta .94 crashes the entire site if there are blank .mdown files present in the filesystem.

I would consider this a bug, since the desired behavior for any situation I can think of would be to ignore blank files.

Should be a very easy fix - should I branch nesta just for this?

BACKTRACE
(condense)
JUMP TO: GET POST COOKIES ENV
/Users/nathanael/.rvm/gems/ruby-1.9.2-p180@nesta/gems/nesta-0.9.4/lib/nesta/models.rb in paragraph_is_metadata
      text.split("\n").first =~ /^[\w ]+:/
/Users/nathanael/.rvm/gems/ruby-1.9.2-p180@nesta/gems/nesta-0.9.4/lib/nesta/models.rb in parse_file
      if paragraph_is_metadata(first_para)
/Users/nathanael/.rvm/gems/ruby-1.9.2-p180@nesta/gems/nesta-0.9.4/lib/nesta/models.rb in initialize
      parse_file
/Users/nathanael/.rvm/gems/ruby-1.9.2-p180@nesta/gems/nesta-0.9.4/lib/nesta/models.rb in new
            @@cache[path] = self.new(filename)
/Users/nathanael/.rvm/gems/ruby-1.9.2-p180@nesta/gems/nesta-0.9.4/lib/nesta/models.rb in block (2 levels) in load
            @@cache[path] = self.new(filename)
/Users/nathanael/.rvm/gems/ruby-1.9.2-p180@nesta/gems/nesta-0.9.4/lib/nesta/models.rb in each
        [path, File.join(path, 'index')].each do |basename|
/Users/nathanael/.rvm/gems/ruby-1.9.2-p180@nesta/gems/nesta-0.9.4/lib/nesta/models.rb in block in load
        [path, File.join(path, 'index')].each do |basename|
/Users/nathanael/.rvm/gems/ruby-1.9.2-p180@nesta/gems/nesta-0.9.4/lib/nesta/models.rb in each
      FORMATS.each do |format|
/Users/nathanael/.rvm/gems/ruby-1.9.2-p180@nesta/gems/nesta-0.9.4/lib/nesta/models.rb in load
      FORMATS.each do |format|
/Users/nathanael/.rvm/gems/ruby-1.9.2-p180@nesta/gems/nesta-0.9.4/lib/nesta/models.rb in block in find_all
        load(relative.sub(/\.(#{FORMATS.join('|')})/, ""))
/Users/nathanael/.rvm/gems/ruby-1.9.2-p180@nesta/gems/nesta-0.9.4/lib/nesta/models.rb in map
      Dir.glob(file_pattern).map do |path|
/Users/nathanael/.rvm/gems/ruby-1.9.2-p180@nesta/gems/nesta-0.9.4/lib/nesta/models.rb in find_all
      Dir.glob(file_pattern).map do |path|
/Users/nathanael/.rvm/gems/ruby-1.9.2-p180@nesta/gems/nesta-0.9.4/lib/nesta/models.rb in find_articles
      find_all.select do |page|
/Users/nathanael/.rvm/gems/ruby-1.9.2-p180@nesta/gems/nesta-0.9.4/lib/nesta/app.rb in latest_articles
gma commented 13 years ago

Hi. Thanks for the bug report. When you say "very easy fix", what have you got in mind? If we agree on the approach a fork/pull request (with tests if appropriate) would be much appreciated.

I haven't time to fix it myself this week, would probably be able to release 0.9.5 if you had time to patch it in a manner that we both agreed made sense.

Cheers, Graham

lilith commented 13 years ago

Basically inserting a nullref check that causes the file to be skipped if it is empty. I'll let you know if I get time to fix it, right now I'm kind of busy as well.

On Tue, Apr 12, 2011 at 4:11 PM, gma < reply@reply.github.com>wrote:

Hi. Thanks for the bug report. When you say "very easy fix", what have you got in mind? If we agree on the approach a fork/pull request (with tests if appropriate) would be much appreciated.

I haven't time to fix it myself this week, would probably be able to release 0.9.5 if you had time to patch it in a manner that we both agreed made sense.

Cheers, Graham

Reply to this email directly or view it on GitHub: https://github.com/gma/nesta/issues/44#comment_989671

gma commented 13 years ago

Fixed in 0.9.5 (imminent).