#1738 修复图片下载次数不正确问题
This commit is contained in:
parent
c893a2d99b
commit
5d1a5a0b11
10
Gemfile
10
Gemfile
|
@ -25,8 +25,10 @@ gem 'rufus-scheduler'
|
|||
#gem 'dalli', path: 'lib/dalli-2.7.2'
|
||||
group :development do
|
||||
gem 'grape-swagger'
|
||||
gem 'grape-swagger-ui', git: 'https://github.com/guange2015/grape-swagger-ui.git'
|
||||
#gem 'grape-swagger-ui', git: 'https://github.com/guange2015/grape-swagger-ui.git'
|
||||
#gem 'puma'
|
||||
gem 'pry-rails'
|
||||
gem 'pry-byebug'
|
||||
gem 'better_errors', path: 'lib/better_errors'
|
||||
gem 'rack-mini-profiler', path: 'lib/rack-mini-profiler'
|
||||
end
|
||||
|
@ -50,8 +52,8 @@ group :test do
|
|||
#end
|
||||
end
|
||||
|
||||
gem 'rspec-rails' , '2.13.1'
|
||||
gem 'guard-rspec','2.5.0'
|
||||
# gem 'rspec-rails' , '2.13.1'
|
||||
# gem 'guard-rspec','2.5.0'
|
||||
# Gems used only for assets and not required
|
||||
# in production environments by default.
|
||||
group :assets do
|
||||
|
@ -95,7 +97,7 @@ if File.exist?(database_file)
|
|||
adapters.each do |adapter|
|
||||
case adapter
|
||||
when 'mysql2'
|
||||
gem "mysql2", "= 0.3.11", :platforms => [:mri, :mingw]
|
||||
gem "mysql2", "= 0.3.18", :platforms => [:mri, :mingw]
|
||||
gem "activerecord-jdbcmysql-adapter", :platforms => :jruby
|
||||
when 'mysql'
|
||||
gem "mysql", "~> 2.8.1", :platforms => [:mri, :mingw]
|
||||
|
|
|
@ -97,12 +97,10 @@ class AttachmentsController < ApplicationController
|
|||
end
|
||||
if candown || User.current.admin? || User.current.id == @attachment.author_id
|
||||
@attachment.increment_download
|
||||
|
||||
if stale?(:etag => @attachment.digest)
|
||||
# images are sent inline
|
||||
send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
|
||||
:type => detect_content_type(@attachment),
|
||||
:disposition => (@attachment.image? ? 'inline' : 'attachment')
|
||||
:disposition => 'attachment' #inline can open in browser
|
||||
end
|
||||
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue