Mercurial > hg > soundsoftware-site
diff app/controllers/attachments_controller.rb @ 967:19884e9d5eff bug_521
Only count downloads from non-bots
author | Chris Cannam <chris.cannam@soundsoftware.ac.uk> |
---|---|
date | Wed, 17 Oct 2012 10:42:48 +0100 |
parents | 35782bf2eb58 |
children | bb32da3bea34 |
line wrap: on
line diff
--- a/app/controllers/attachments_controller.rb Tue Oct 16 15:34:00 2012 +0100 +++ b/app/controllers/attachments_controller.rb Wed Oct 17 10:42:48 2012 +0100 @@ -17,6 +17,9 @@ class AttachmentsController < ApplicationController + include AttachmentsHelper + helper :attachments + before_filter :find_project before_filter :file_readable, :read_authorize, :except => :destroy before_filter :delete_authorize, :only => :destroy @@ -50,8 +53,10 @@ def download # cc: formerly this happened only if "@attachment.container.is_a?(Version)" - # or Project. Not good for us, we want to tally all downloads - @attachment.increment_download + # or Project. Not good for us, we want to tally all downloads [by humans] + if not user_is_search_bot? + @attachment.increment_download + end # images are sent inline send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),