#1738 修复图片下载次数不正确问题

This commit is contained in:
guange 2015-03-10 11:50:27 +08:00
parent c893a2d99b
commit 5d1a5a0b11
2 changed files with 7 additions and 7 deletions

10
Gemfile
View File

@ -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]

View File

@ -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