@@ -16,17 +16,22 | |||
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
17 | 17 | |
|
18 | 18 | class AttachmentsController < ApplicationController |
|
19 | layout 'base' | |
|
19 | 20 | before_filter :find_project, :check_project_privacy |
|
20 | 21 | |
|
21 | 22 | # sends an attachment |
|
22 | 23 | def download |
|
23 | 24 | send_file @attachment.diskfile, :filename => @attachment.filename |
|
25 | rescue | |
|
26 | render_404 | |
|
24 | 27 | end |
|
25 | 28 | |
|
26 | 29 | # sends an image to be displayed inline |
|
27 | 30 | def show |
|
28 | 31 | render(:nothing => true, :status => 404) and return unless @attachment.diskfile =~ /\.(jpeg|jpg|gif|png)$/i |
|
29 | 32 | send_file @attachment.diskfile, :type => "image/#{$1}", :disposition => 'inline' |
|
33 | rescue | |
|
34 | render_404 | |
|
30 | 35 | end |
|
31 | 36 | |
|
32 | 37 | private |
General Comments 0
You need to be logged in to leave comments.
Login now