Project

General

Profile

Actions

Defect #25702

closed

Exporting wiki page with specific table to PDF causes 500

Added by Leon Blakey over 7 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
PDF export
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

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

Files

wiki_crash.txt (5.28 KB) wiki_crash.txt Leon Blakey, 2017-04-26 14:49
1.png (45.7 KB) 1.png Toshi MARUYAMA, 2017-05-26 12:31
Actions #1

Updated by Toshi MARUYAMA over 7 years ago

  • Category changed from Wiki to PDF export
Actions #2

Updated by Toshi MARUYAMA over 7 years ago

  • File 1.png 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
Actions #3

Updated by Leon Blakey over 7 years 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.

Actions #4

Updated by Toshi MARUYAMA over 7 years 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'
Actions #5

Updated by Jun NAITOH about 7 years ago

This problem fixed by rbpdf 1.19.3.
please bundle update.

Actions #6

Updated by Go MAEDA about 7 years 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.

Actions #7

Updated by Go MAEDA about 7 years 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
Actions #8

Updated by Toshi MARUYAMA about 7 years ago

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

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

Actions

Also available in: Atom PDF