]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/trace_controller.rb
Allow uncompressed GPX traces to be fetched from the API
[rails.git] / app / controllers / trace_controller.rb
index 60b6502e20b7b1a56fd198971f671ed692f8553b..1a75ac4cc455786b799ef7525245d09d154ad510 100644 (file)
@@ -292,7 +292,11 @@ class TraceController < ApplicationController
     trace = Trace.find(params[:id])
 
     if trace.public? or trace.user == @user
-      send_file(trace.trace_name, :filename => "#{trace.id}#{trace.extension_name}", :type => trace.mime_type, :disposition => 'attachment')
+      if request.format == Mime::XML
+        send_file(trace.xml_file, :filename => "#{trace.id}.xml", :type => Mime::XML.to_s, :disposition => 'attachment')
+      else
+        send_file(trace.trace_name, :filename => "#{trace.id}#{trace.extension_name}", :type => trace.mime_type, :disposition => 'attachment')
+      end
     else
       render :nothing => true, :status => :forbidden
     end