Feature #4477

Use mime types in downloading from repository

Added by Felix Schäfer almost 8 years ago. Updated over 6 years ago.

Status:ClosedStart date:2009-12-23
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:SCM
Target version:1.2.0
Resolution:Fixed

Description

Ok, so appart from the export: links in "wiki" fields looking ugly (are there plans to make them show either only the filename or even make the links "configurable" like http links?), I had a user asking if there was a way to make the pdfs he had in the repo be shown in the browser instead of force-downloading them.

I have whipped up a small patch (somewhat looked off of the mimetype-fu plugin) that guesses the mime-type of a file according to its extension and Mime::Type and sets the disposition to inline to make browsers show them instead of downloading them. The patch is attached, but it changes the behavior of the "raw" download action also used by the download-Link in the repository tab.

That brings us to the discussion if the "raw" Links should be changed, or if an extra action, say show, should be configured, but the changes to the patch should be quite straightforward.

Last but not least: there are only a very few mime types defined in redmine at the moment, one source for some more could e.g. be this list from the mimetype-fu plugin.

mime_type_and_inlne_repo_files.patch Magnifier (1.08 KB) Felix Schäfer, 2009-12-23 23:54


Related issues

Related to Redmine - Defect #6256: Redmine considers non ASCII and UTF-16 text files as bina... Closed 2010-08-31
Related to Redmine - Feature #2209: MIME type support for repository Entries New 2008-11-17
Duplicated by Redmine - Feature #5055: Set mime-type in response when downloading repository files Closed 2010-03-11

History

#1 Updated by Andrea Campi almost 8 years ago

+1 for the concept (although I haven't tried out the attached patch).

#2 Updated by Toshi MARUYAMA over 6 years ago

  • Tracker changed from Patch to Feature

#3 Updated by Toshi MARUYAMA over 6 years ago

  • Subject changed from Make export show repository files instead of forcing download to Use mime types in downloading from repository

#4 Updated by Toshi MARUYAMA over 6 years ago

  • Status changed from New to Closed
  • Target version set to 1.2.0
  • Resolution set to Fixed

Original subject problem is similar with #6256.

This issue feature is implemented by r5210.

#5 Updated by Toshi MARUYAMA over 6 years ago

AttachmentsController uses "inline" for only images.
See source:tags/1.1.2/app/controllers/attachments_controller.rb#L43.

Also available in: Atom PDF