vvmruder / redmine_doc_pu

Redmine Wikipage to (eye catching) PDF plugin
Do What The F*ck You Want To Public License
4 stars 3 forks source link

Internal Error: NoMethodError (undefined method `match' for nil:NilClass) #15

Open rg-ac opened 6 years ago

rg-ac commented 6 years ago

On some pages I have an 'Internal Error' and in the logfile I see:

NoMethodError (undefined method match' for nil:NilClass): plugins/redmine_doc_pu/lib/latex_wiki_page.rb:10:inblock in to_latex' plugins/redmine_doc_pu/lib/latex_wiki_page.rb:9:in to_latex' plugins/redmine_doc_pu/app/models/doc_pu_wiki_page.rb:24:into_latex' plugins/redmine_doc_pu/lib/latex_doc.rb:67:in block in to_latex' plugins/redmine_doc_pu/lib/latex_doc.rb:66:into_latex' plugins/redmine_doc_pu/lib/latex_doc.rb:120:in build' plugins/redmine_doc_pu/app/models/doc_pu_document.rb:27:inbuild' plugins/redmine_doc_pu/app/controllers/doc_pu_controller.rb:101:in build_remote' lib/redmine/sudo_mode.rb:63:insudo_mode'

Environment: Redmine version 3.2.8.stable Ruby version 2.2.9-p480 (2017-12-15) [x86_64-linux] Rails version 4.2.7.1 Environment production Database adapter Mysql2 SCM: Subversion 1.8.8 Git 1.9.1 Filesystem
Redmine plugins: redmine_backlogs v1.0.6 redmine_base_deface 0.0.1 redmine_doc_pu 2.1.0 redmine_maintenance_mode 2.1.0

Any Ideas?

rg-ac commented 6 years ago

Here is a diff which fixed it for me

--- a/lib/latex_wiki_page.rb +++ b/lib/latex_wiki_page.rb @@ -7,8 +7,10 @@ module ModuleLatexWikiPage # Collect all attached images and get disk filename file_sub = {} self.wiki_page.attachments.each do |att| - unless att.content_type.match(/^image/i).nil? - file_sub[att.filename] = att.diskfile + if att.content_type + unless att.content_type.match(/^image/i).nil? + file_sub[att.filename] = att.diskfile + end end end

btw. how to paste Diff in markdown?