Vote #78422
完了Exporting wiki page with specific table to PDF causes 500
0%
説明
I am getting this exception when saving the attached wiki page to PDF.
Started GET "/projects/sandbox/wiki/User3.pdf" for 74.143.73.222 at 2017-04-26 12:00:05 +0000
Processing by WikiController#show as PDF
Parameters: {"project_id"=>"sandbox", "id"=>"User3"}
Current user: LBlakey (id=25)
Rendered wiki/show.pdf.erb (2394.5ms)
Completed 500 Internal Server Error in 2447ms (ActiveRecord: 42.0ms)
ActionView::Template::Error (undefined method `[]' for nil:NilClass):
1: <%= raw wiki_page_to_pdf(@page, @project) %>
lib/redmine/export/pdf.rb:95:in `RDMwriteFormattedCell'
lib/redmine/export/pdf/wiki_pdf_helper.rb:79:in `write_wiki_page'
lib/redmine/export/pdf/wiki_pdf_helper.rb:55:in `wiki_page_to_pdf'
app/views/wiki/show.pdf.erb:1:in `_app_views_wiki_show_pdf_erb___2725341082725750565_42106300'
lib/redmine/sudo_mode.rb:63:in `sudo_mode'
Steps to reproduce
Create a wiki page called User3¶
Paste in the contents of the attached wiki_crash.txt file. Save¶
Click the PDF link at the bottom of the page. Get 500 error and the above exception in the logs¶
Edit the page and remove the last word "r" at the end of the table. Save¶
Click the PDF link again. Page saves successfully¶
System Information
Uses the docker redmine:latest image
Environment: Redmine version 3.3.2.stable Ruby version 2.2.6-p396 (2016-11-15) [x86_64-linux] Rails version 4.2.7.1 Environment production Database adapter Mysql2 SCM: Subversion 1.8.10 Mercurial 3.1.2 Bazaar 2.7.0 Git 2.1.4 Filesystem Redmine plugins: no plugin installed
journals
--------------------------------------------------------------------------------
I cannot reproduce.
!1.png!
<pre>
Environment:
Redmine version 3.3.3.stable
Ruby version 1.9.3-p551 (2014-11-13) [x86_64-linux]
Rails version 4.2.7.1
Environment production
Database adapter SQLite
SCM:
Subversion 1.7.14
Mercurial 2.8.2
Cvs 1.12.13
Git 1.8.3.1
Filesystem
Redmine plugins:
no plugin installed
</pre>
--------------------------------------------------------------------------------
Thanks for looking at this. This happens with textile, maybe your wiki syntax is still set to markdown?
I reproduced again on 3.3.3 (latest docker image) with that wiki page name and text.
--------------------------------------------------------------------------------
<pre>
Started GET "/test-3.3-stable/projects/hg-main/wiki/Test.pdf" for 127.0.0.1 at 2017-06-29 14:53:31 +0900
Processing by WikiController#show as PDF
Parameters: {"project_id"=>"hg-main", "id"=>"Test"}
Current user: admin (id=1)
Rendered wiki/show.pdf.erb (375.6ms)
Completed 500 Internal Server Error in 583ms (ActiveRecord: 201.3ms)
ActionView::Template::Error (undefined method `[]' for nil:NilClass):
1: <%= raw wiki_page_to_pdf(@page, @project) %>
lib/redmine/export/pdf.rb:95:in `RDMwriteFormattedCell'
lib/redmine/export/pdf/wiki_pdf_helper.rb:79:in `write_wiki_page'
lib/redmine/export/pdf/wiki_pdf_helper.rb:55:in `wiki_page_to_pdf'
app/views/wiki/show.pdf.erb:1:in `_app_views_wiki_show_pdf_erb___3121506352715590158_69887059880660'
lib/redmine/sudo_mode.rb:63:in `sudo_mode'
</pre>
--------------------------------------------------------------------------------
This problem fixed by rbpdf 1.19.3.
please bundle update.
--------------------------------------------------------------------------------
Jun NAITOH wrote:
> This problem fixed by rbpdf 1.19.3.
> please bundle update.
The latest rbpdf fixed the same problem on our customer's instance. Thank you for updating the gem.
--------------------------------------------------------------------------------
I think it would be better to update Gemfile to ensure that the fixed version of rbpdf will be installed.
<pre><code class="diff">
Index: Gemfile
===================================================================
--- Gemfile (revision 16952)
+++ Gemfile (working copy)
@@ -21,7 +21,7 @@
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :x64_mingw, :mswin]
-gem "rbpdf", "~> 1.19.2"
+gem "rbpdf", "~> 1.19.3"
# Optional gem for LDAP authentication
group :ldap do
</code></pre>
--------------------------------------------------------------------------------
Gemfile is updated in 3.3-stable, 3.4-stable, and trunk, thanks.
--------------------------------------------------------------------------------