预览时,下载次数不累加

This commit is contained in:
guange 2015-06-18 21:39:12 +08:00
parent 7a9b5712c0
commit 4aeac1bd64
1 changed files with 1 additions and 1 deletions

View File

@ -68,6 +68,7 @@ class AttachmentsController < ApplicationController
end
def direct_download
@attachment.increment_download
send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
:type => detect_content_type(@attachment),
:disposition => 'attachment' #inline can open in browser
@ -78,7 +79,6 @@ class AttachmentsController < ApplicationController
# 下载添加权限设置
candown = attachment_candown @attachment
if candown || User.current.admin? || User.current.id == @attachment.author_id
@attachment.increment_download
if stale?(:etag => @attachment.digest)
if params[:preview] == 'true'
convered_file = @attachment.diskfile