Project

General

Profile

Actions

Patch #3782

closed

broken downloads of attached files after trac import due to missing mime type definitions

Added by he buiss over 14 years ago. Updated over 14 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Importers
Target version:
Start date:
2009-08-26
Due date:
% Done:

0%

Estimated time:

Description

After importing my Trac data to redmine via "migrate_from_trac" I noticed that several files, which have been attached to tickets, cannot be downloaded correctly due to wrong mime type information.

The problem is that several files have no information in column "file_type" of redmine's "attachment" table. This information is being generated by "Redmine::MimeType.of(filename)" which is described in file /lib/redmine/mime_type.rb .

My suggestion is, to add some more mime types to this definition:

    MIME_TYPES = {
      'text/plain' => 'txt,tpl,properties,patch,diff,ini,readme,install,upgrade',
      'text/css' => 'css',
      'text/html' => 'html,htm,xhtml',
      'text/jsp' => 'jsp',
    ...

The ones, I added, were:

      'application/msword' => 'doc',
      'application/vnd.ms-excel' => 'xls',
      'application/vnd.ms-powerpoint' => 'ppt',
      'application/vnd.ms-powerpoint' => 'pps',
      'application/vnd.oasis.opendocument.text' => 'odt',
      'application/vnd.oasis.opendocument.presentation' => 'odp',
      'application/vnd.oasis.opendocument.spreadsheet' => 'ods',
      'application/pdf' => 'pdf',
      'application/rtf' => 'rtf',
      'application/zip' => 'zip',
      'application/x-rar-compressed' => 'rar',
      'application/x-tar' => 'tar',

A nice collection of mime types can be found here: http://de.selfhtml.org/diverses/mimetypen.htm#uebersicht


Files

new_mime_types.patch (2.89 KB) new_mime_types.patch Support more mime-types Babar O'Cap, 2009-09-21 17:43
Actions

Also available in: Atom PDF