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