Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 46
- Log:
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.
- Author:
- adh
- Date:
- Wed Aug 02 20:11:52 +0100 2006
- Size:
- 566 Bytes
1 | require 'mime/types' |
2 | |
3 | class AttachmentController < ApplicationController |
4 | def fetch |
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' |
12 | rescue |
13 | flash[:alert] = l(:attachment_not_found) |
14 | |
15 | if (@request.referer and @request.referer != '') |
16 | redirect_to @request.referer |
17 | else |
18 | redirect_to :controller => '' |
19 | end |
20 | end |
21 | end |