Defect #25702

Exporting wiki page with specific table to PDF causes 500

Added by Leon Blakey 7 months ago. Updated about 1 month ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:PDF export
Target version:3.3.5
Resolution:Fixed Affected version:3.3.3

Description

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

  1. Create a wiki page called User3
  2. Paste in the contents of the attached wiki_crash.txt file. Save
  3. Click the PDF link at the bottom of the page. Get 500 error and the above exception in the logs
  4. Edit the page and remove the last word "r" at the end of the table. Save
  5. 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

wiki_crash.txt Magnifier (5.28 KB) Leon Blakey, 2017-04-26 14:49

1.png (45.7 KB) Toshi MARUYAMA, 2017-05-26 12:31

Associated revisions

Revision 16975
Added by Toshi MARUYAMA about 1 month ago

Gemfile: update rbpdf version to 1.19.3 (#25702)

Revision 16979
Added by Toshi MARUYAMA about 1 month ago

Merged r16975 from trunk to 3.4-stable (#25702)

Gemfile: update rbpdf version to 1.19.3.

Revision 16982
Added by Toshi MARUYAMA about 1 month ago

Merged r16975 from trunk to 3.3-stable (#25702)

Gemfile: update rbpdf version to 1.19.3.

History

#1 Updated by Toshi MARUYAMA 7 months ago

  • Category changed from Wiki to PDF export

#2 Updated by Toshi MARUYAMA 6 months ago

  • File 1.png added
  • Status changed from New to Needs feedback

I cannot reproduce.

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

#3 Updated by Leon Blakey 5 months ago

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.

#4 Updated by Toshi MARUYAMA 5 months ago

  • Status changed from Needs feedback to Confirmed
  • Affected version changed from 3.3.2 to 3.3.3
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'

#5 Updated by Jun NAITOH 2 months ago

This problem fixed by rbpdf 1.19.3.
please bundle update.

#6 Updated by Go MAEDA 2 months ago

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.

#7 Updated by Go MAEDA 2 months ago

  • Target version set to 3.3.5

I think it would be better to update Gemfile to ensure that the fixed version of rbpdf will be installed.

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

#8 Updated by Toshi MARUYAMA about 1 month ago

  • Status changed from Confirmed to Closed
  • Resolution set to Fixed

Gemfile is updated in 3.3-stable, 3.4-stable, and trunk, thanks.

Also available in: Atom PDF