Project

General

Profile

Actions

Bug #2513

open

wiki#export (ActionView::Template::Error) "undefined method `[]' for nil:NilClass\n\n ...

Added by liaham 6 months ago. Updated 4 months ago.

Status:
New
Priority:
Normal
Assignee:
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Affected Version:
Compatible Redmine Version:
n/a

Description

An ActionView::Template::Error occurred in wiki#export:



  undefined method `[]' for nil:NilClass



              annots << sprintf(' /Dest [%d 0 R /XYZ 0 %.2f null]', 1 + (2 * l[0]), @pagedim[l[0]]['h'] - (l[1] * @k))

                                                                              ^^^


  lib/redmine/export/pdf/wiki_pdf_helper.rb:38:in `wiki_pages_to_pdf'

  app/views/wiki/export.pdf.erb:1

  lib/redmine/sudo_mode.rb:61:in `sudo_mode'

  plugins/redmine_dmsf/lib/redmine_dmsf/webdav/custom_middleware.rb:56:in `call'

  • Parameters : {"controller"=>"wiki", "action"=>"export", "project_id"=>"some-project", "format"=>"pdf"}
Actions #1

Updated by liaham 6 months ago

  • Parent task set to #2512
Actions #2

Updated by liaham 6 months ago · Edited

The line raising the exception is in ruby gem rbpdf version 1.21.3 in RBPDF#putannotsobjs:

# rbpdf-1.21.3/lib/rbpdf.rb:6268
            else
              # internal link
              l = @links[pl['txt']] # <-- l must be nil to raise the error
              annots << sprintf(' /Dest [%d 0 R /XYZ 0 %.2f null]', 1 + (2 * l[0]), @pagedim[l[0]]['h'] - (l[1] * @k))
            end

These lines of code will only then be crossed when multiple wiki pages should be merged into a single pdf file.

pl is a hash with content like this: {"x"=>18.062575, "y"=>37.85658333333333, "w"=>23.460075, "h"=>3.175, "txt"=>1, "opt"=>{"subtype"=>"Link"}, "numspaces"=>0}.

The 'txt' variable comes from method RBPDF#Annotation(x, y, w, h, text, opt={'Subtype'=>'Text'}, spaces=0). It gets its params from RBPDF#Link what again gets the text param meanwhile called link from RBPDF#AddLink.

Actions #3

Updated by liaham 5 months ago

Unfortunately, the error is not reproducible.

Actions #4

Updated by liaham 4 months ago

  • Target version changed from 5.1.4 to 6.0.0
  • Parent task deleted (#2512)
Actions

Also available in: Atom PDF