@@ -52,19 +52,22 class AttachmentsController < ApplicationController | |||
|
52 | 52 | @attachment.increment_download |
|
53 | 53 | end |
|
54 | 54 | |
|
55 | # images are sent inline | |
|
56 | send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename), | |
|
57 | :type => detect_content_type(@attachment), | |
|
58 |
|
|
|
59 | ||
|
55 | if stale?(:etag => @attachment.digest) | |
|
56 | # images are sent inline | |
|
57 | send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename), | |
|
58 | :type => detect_content_type(@attachment), | |
|
59 | :disposition => (@attachment.image? ? 'inline' : 'attachment') | |
|
60 | end | |
|
60 | 61 | end |
|
61 | 62 | |
|
62 | 63 | def thumbnail |
|
63 | 64 | if @attachment.thumbnailable? && Setting.thumbnails_enabled? && thumbnail = @attachment.thumbnail |
|
64 |
|
|
|
65 | :filename => filename_for_content_disposition(@attachment.filename), | |
|
66 |
|
|
|
67 | :disposition => 'inline' | |
|
65 | if stale?(:etag => thumbnail) | |
|
66 | send_file thumbnail, | |
|
67 | :filename => filename_for_content_disposition(@attachment.filename), | |
|
68 | :type => detect_content_type(@attachment), | |
|
69 | :disposition => 'inline' | |
|
70 | end | |
|
68 | 71 | else |
|
69 | 72 | # No thumbnail for the attachment or thumbnail could not be created |
|
70 | 73 | render :nothing => true, :status => 404 |
General Comments 0
You need to be logged in to leave comments.
Login now