Defect #23246

Saving an empty Markdown image tag in Wiki pages causes internal server error

Added by Viktor Berke over 4 years ago. Updated over 4 years ago.

Status:ClosedStart date:
Priority:HighDue date:
Assignee:Jean-Philippe Lang% Done:


Category:Text formatting
Target version:3.2.4
Resolution:Fixed Affected version:3.3.0


Steps to reproduce:

- use Markdown Wiki formatting
- Create a Wiki page
- Add an empty image tag, i.e.:


- Save the changes
- From now on, this page will show an internal server error, eventually also crashing the whole Redmine instance

The log shows the following error:

Started GET "/projects/fpga/wiki" for at 2016-07-05 11:28:01 +0200
Processing by WikiController#show as HTML
  Parameters: {"project_id"=>"fpga"}
  Current user: (id=17)
  Rendered wiki/_content.html.erb (9.7ms)
  Rendered wiki/show.html.erb within layouts/base (31.2ms)
Completed 500 Internal Server Error in 277ms (ActiveRecord: 23.1ms)

ActionView::Template::Error (undefined method `include?' for nil:NilClass):
    1: <div class="wiki wiki-page">
    2:   <%= textilizable content, :text, :attachments =>,
    3:         :edit_section_links => (@sections_editable && {:controller => 'wiki', :action => 'edit', :project_id => @page.project, :id => @page.title}) %>
    4: </div>
  lib/redmine/helpers/url.rb:26:in `uri_with_safe_scheme?'
  lib/redmine/wiki_formatting/markdown/formatter.rb:48:in `image'
  lib/redmine/wiki_formatting/markdown/formatter.rb:60:in `render'
  lib/redmine/wiki_formatting/markdown/formatter.rb:60:in `to_html'
  lib/redmine/wiki_formatting.rb:89:in `to_html'
  app/helpers/application_helper.rb:598:in `textilizable'
  app/views/wiki/_content.html.erb:2:in `_app_views_wiki__content_html_erb__2292234759012989548_70948640'
  app/views/wiki/show.html.erb:47:in `_app_views_wiki_show_html_erb___1795174084185801307_65213660'
  app/controllers/wiki_controller.rb:114:in `show'
  lib/redmine/sudo_mode.rb:63:in `sudo_mode'

Related issues

Duplicated by Redmine - Defect #23395: Markdown formatter crashes Closed

Associated revisions

Revision 15607
Added by Jean-Philippe Lang over 4 years ago

Fixed that empty Markdown image tag raises en error (#23246).


#1 Updated by Viktor Berke over 4 years ago

At this point, the only way to solve this is delete this line directly from the database.

#2 Updated by Jean-Philippe Lang over 4 years ago

  • Category changed from Wiki to Text formatting
  • Status changed from New to Resolved
  • Assignee set to Jean-Philippe Lang
  • Target version set to 3.2.4
  • Resolution set to Fixed

Fixed in r15607, thanks for pointing this out.

#3 Updated by Viktor Berke over 4 years ago

Wow, that was crazy fast! Applied this oneliner to our instance and I'm happy to confirm it indeed works now. Thanks a lot, Jean-Philippe.

#4 Updated by Jean-Philippe Lang over 4 years ago

  • Status changed from Resolved to Closed

Thanks for your feedback.

#5 Updated by Toshi MARUYAMA over 4 years ago

#6 Updated by Toshi MARUYAMA about 4 years ago

#7 Updated by Toshi MARUYAMA about 4 years ago

Also available in: Atom PDF