Changesets can be listed by changeset number.
The Git repository is here.
Changeset 46
RForum attachments should now be displayed inline for any MIME types
known to the mime-types gem. Requires installation of said gem, so it
introduces a new external dependency. MIME type is based upon the
filename extension on the original uploaded file. Not submitted as an
RForum patch because it's a rather specific feature and the need for
the mime-types gem makes it less attractive to a more general user.
- Comitted by: adh
- Date: Wednesday August 02 20:11:52 2006 (over 18 years ago)
Affected files:
rool/rails/rforum/trunk/app/controllers/attachment_controller.rb:
prev. | current | |
1 | require 'mime/types' | |
2 | ||
class AttachmentController < ApplicationController | ||
def fetch | ||
3 | | |
4 | | |
5 | id = @params[:id] | |
6 | file_path = Attachment.find(id).file_path | |
7 | mime_type = MIME::Types.type_for(file_path) || 'application/octet-stream' | |
8 | ||
9 | send_file file_path, | |
10 | :type => mime_type[0].content_type, | |
11 | :disposition => 'inline' | |
rescue | ||
flash[:alert] = l(:attachment_not_found) | ||