Actions
Bug #2513
openwiki#export (ActionView::Template::Error) "undefined method `[]' for nil:NilClass\n\n ...
Start date:
Due date:
% Done:
0%
Estimated time:
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"}
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