预览时,下载次数不累加
This commit is contained in:
parent
7a9b5712c0
commit
4aeac1bd64
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue