Project

General

Profile

Actions

Defect #23246

closed

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

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

Status:
Closed
Priority:
High
Category:
Text formatting
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

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 127.0.0.1 at 2016-07-05 11:28:01 +0200
Processing by WikiController#show as HTML
  Parameters: {"project_id"=>"fpga"}
  Current user: viktor@foobar.com (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 => content.page.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

Has duplicate Redmine - Defect #23395: Markdown formatter crashesClosed

Actions
Actions #1

Updated by Viktor Berke over 8 years ago

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

Actions #2

Updated by Jean-Philippe Lang over 8 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.

Actions #3

Updated by Viktor Berke over 8 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.

Actions #4

Updated by Jean-Philippe Lang over 8 years ago

  • Status changed from Resolved to Closed

Thanks for your feedback.

Actions #5

Updated by Toshi MARUYAMA over 8 years ago

Actions #6

Updated by Toshi MARUYAMA over 8 years ago

Actions #7

Updated by Toshi MARUYAMA over 8 years ago

Actions

Also available in: Atom PDF