https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292014-04-24T23:33:48ZRedmineRedmine - Patch #16710: Support for the 1.x versions of mime-types gemhttps://www.redmine.org/issues/16710?journal_id=560502014-04-24T23:33:48ZPierre-Louis Bonicoli
<ul></ul><p><code>MIME::Types.find</code> has been added in <code>mime-types</code> <a href="https://github.com/halostatue/mime-types/commit/644259db36c69884735aa66aa6fdee690dfa9f7b" class="external">here</a>.<br />There is another error if this <a href="https://github.com/halostatue/mime-types/commit/fd53425e33046932cebcf0d3d8f92c3e35cd4472" class="external">additional commit</a> is not used.<br />Both commits are included in mime-types 1.23.</p>
<p>Particularly <code>MIME::Types.find</code> is used in <code>lib/redmine/mime_type.rb</code> since <a class="changeset" title="Use the mime-types gem for getting mime types from filenames (#15790)." href="https://www.redmine.org/projects/redmine/repository/svn/revisions/12483">r12483</a>.</p>
The problem doesn't occur:
<ul>
<li>either with mime-types 1.23</li>
<li>or with mime-types 1.19 when <a class="attachment" href="https://www.redmine.org/attachments/11487">redmine-2.5.1-mime-types.patch</a> is applied</li>
</ul>
<p>First error fixed by <a href="https://github.com/halostatue/mime-types/commit/644259db36c69884735aa66aa6fdee690dfa9f7b" class="external">644259db36c69884735aa66aa6fdee690dfa9f7b</a>:<br /><pre>
ActionView::Template::Error (undefined method `find' for MIME::Types:Class):
1: <div class="attachments">
2: <% for attachment in attachments %>
3: <p><%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%>
4: <% if attachment.is_text? %>
5: <%= link_to image_tag('magnifier.png'),
6: :controller => 'attachments', :action => 'show',
lib/redmine/mime_type.rb:63:in `block in of'
lib/redmine/mime_type.rb:66:in `yield'
lib/redmine/mime_type.rb:66:in `default'
lib/redmine/mime_type.rb:66:in `of'
lib/redmine/mime_type.rb:78:in `main_mimetype_of'
lib/redmine/mime_type.rb:85:in `is_type?'
app/models/attachment.rb:217:in `is_text?'
app/views/attachments/_links.html.erb:3:in `block in _app_views_attachments__links_html_erb___3782281663955472009_30361420'
app/views/attachments/_links.html.erb:2:in `_app_views_attachments__links_html_erb___3782281663955472009_30361420'
app/helpers/attachments_helper.rb:31:in `link_to_attachments'
app/views/documents/show.html.erb:19:in `_app_views_documents_show_html_erb___505910332762640252_28753000'
</pre></p>
<p>Second error fixed by <a href="https://github.com/halostatue/mime-types/commit/fd53425e33046932cebcf0d3d8f92c3e35cd4472" class="external">fd53425e33046932cebcf0d3d8f92c3e35cd4472</a>:<br /><pre>
ActionView::Template::Error (undefined method `extensions' for #<Array:0x000000053ecdf8>):
1: <div class="attachments">
2: <% for attachment in attachments %>
3: <p><%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%>
4: <% if attachment.is_text? %>
5: <%= link_to image_tag('magnifier.png'),
6: :controller => 'attachments', :action => 'show',
lib/redmine/mime_type.rb:63:in `block (2 levels) in of'
lib/redmine/mime_type.rb:63:in `find'
lib/redmine/mime_type.rb:63:in `block in of'
lib/redmine/mime_type.rb:66:in `yield'
lib/redmine/mime_type.rb:66:in `default'
lib/redmine/mime_type.rb:66:in `of'
lib/redmine/mime_type.rb:78:in `main_mimetype_of'
lib/redmine/mime_type.rb:85:in `is_type?'
app/models/attachment.rb:217:in `is_text?'
app/views/attachments/_links.html.erb:3:in `block in _app_views_attachments__links_html_erb__4198667861296620514_35003500'
app/views/attachments/_links.html.erb:2:in `_app_views_attachments__links_html_erb__4198667861296620514_35003500'
app/helpers/attachments_helper.rb:31:in `link_to_attachments'
app/views/documents/show.html.erb:19:in `_app_views_documents_show_html_erb__1410191189284416881_31521860'
</pre></p> Redmine - Patch #16710: Support for the 1.x versions of mime-types gemhttps://www.redmine.org/issues/16710?journal_id=560542014-04-25T04:35:31ZEtienne Massip
<ul><li><strong>Target version</strong> set to <i>Candidate for next minor release</i></li></ul> Redmine - Patch #16710: Support for the 1.x versions of mime-types gemhttps://www.redmine.org/issues/16710?journal_id=560822014-04-26T07:44:26ZJean-Philippe Langjp_lang@yahoo.fr
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Resolved</i></li><li><strong>Assignee</strong> set to <i>Jean-Philippe Lang</i></li><li><strong>Target version</strong> changed from <i>Candidate for next minor release</i> to <i>2.5.2</i></li></ul><p>Patch committed in <a class="changeset" title="Support for the 1.x versions of mime-types gem (#16710). Patch by Szilveszter Ördög." href="https://www.redmine.org/projects/redmine/repository/svn/revisions/13107">r13107</a>, thanks.</p> Redmine - Patch #16710: Support for the 1.x versions of mime-types gemhttps://www.redmine.org/issues/16710?journal_id=564872014-05-24T16:40:01ZJean-Philippe Langjp_lang@yahoo.fr
<ul><li><strong>Status</strong> changed from <i>Resolved</i> to <i>Closed</i></li></ul><p>Merged.</p>