##// END OF EJS Templates
Adds Etags on attachments....
Jean-Philippe Lang -
r9780:2dbabde7f40d
parent child
Show More
@@ -52,19 +52,22 class AttachmentsController < ApplicationController
52 52 @attachment.increment_download
53 53 end
54 54
55 if stale?(:etag => @attachment.digest)
55 56 # images are sent inline
56 57 send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
57 58 :type => detect_content_type(@attachment),
58 59 :disposition => (@attachment.image? ? 'inline' : 'attachment')
59
60 end
60 61 end
61 62
62 63 def thumbnail
63 64 if @attachment.thumbnailable? && Setting.thumbnails_enabled? && thumbnail = @attachment.thumbnail
65 if stale?(:etag => thumbnail)
64 66 send_file thumbnail,
65 67 :filename => filename_for_content_disposition(@attachment.filename),
66 68 :type => detect_content_type(@attachment),
67 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