]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/trace_controller.rb
Don't generate an IN condition with an empty list.
[rails.git] / app / controllers / trace_controller.rb
index dc7456c45099ec923731ccd43944be57001bd459..47a31d314e5b42fcce1ebe41a5774f49c2373808 100644 (file)
@@ -57,7 +57,10 @@ class TraceController < ApplicationController
       @tag = params[:tag]
 
       files = Tracetag.find_all_by_tag(params[:tag]).collect { |tt| tt.gpx_id }
-      conditions[0] += " AND gpx_files.id IN (#{files.join(',')})"
+
+      if files.length > 0
+        conditions[0] += " AND gpx_files.id IN (#{files.join(',')})"
+      end
     end
     
     conditions[0] += " AND gpx_files.visible = ?"
@@ -233,6 +236,7 @@ class TraceController < ApplicationController
 
     if trace.inserted?
       if trace.public? or (@user and @user == trace.user)
+        expires_in 7.days, :private => !trace.public, :public => trace.public
         send_file(trace.large_picture_name, :filename => "#{trace.id}.gif", :type => 'image/gif', :disposition => 'inline')
       else
         render :nothing => true, :status => :forbidden
@@ -249,6 +253,7 @@ class TraceController < ApplicationController
 
     if trace.inserted?
       if trace.public? or (@user and @user == trace.user)
+        expires_in 7.days, :private => !trace.public, :public => trace.public
         send_file(trace.icon_picture_name, :filename => "#{trace.id}_icon.gif", :type => 'image/gif', :disposition => 'inline')
       else
         render :nothing => true, :status => :forbidden