diff -r b31caaed9d4d -r e2c122809c5c app/controllers/attachments_controller.rb
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -52,18 +52,18 @@
   end
 
   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 [by humans]
-    if not user_is_search_bot?
-      @attachment.increment_download
-    end
-
     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')
     end
+
+    # cc: formerly this happened only if "@attachment.container.is_a?(Version)"
+    # or Project. Not good for us, we want to tally all downloads [by humans]
+    if not user_is_search_bot?
+      @attachment.increment_download
+    end
   end
 
   def thumbnail
