From: Tom Hughes Date: Mon, 9 Sep 2013 15:23:38 +0000 (+0100) Subject: Return GPX traces as application/gpx+xml instead of text/xml X-Git-Tag: live~5357 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/7e896d758d33d9bccb36ace4e11b0d795b5e700b Return GPX traces as application/gpx+xml instead of text/xml --- diff --git a/app/controllers/trace_controller.rb b/app/controllers/trace_controller.rb index 0725957bf..d54778c6e 100644 --- a/app/controllers/trace_controller.rb +++ b/app/controllers/trace_controller.rb @@ -151,8 +151,8 @@ class TraceController < ApplicationController if trace.visible? and (trace.public? or (@user and @user == trace.user)) if Acl.no_trace_download(request.remote_ip) render :text => "", :status => :forbidden - elsif request.format == Mime::XML - send_file(trace.xml_file, :filename => "#{trace.id}.xml", :type => Mime::XML.to_s, :disposition => 'attachment') + elsif request.format == Mime::XML or request.format == Mime::GPX + send_file(trace.xml_file, :filename => "#{trace.id}.xml", :type => request.format.to_s, :disposition => 'attachment') else send_file(trace.trace_name, :filename => "#{trace.id}#{trace.extension_name}", :type => trace.mime_type, :disposition => 'attachment') end @@ -308,8 +308,8 @@ class TraceController < ApplicationController trace = Trace.find(params[:id]) if trace.public? or trace.user == @user - if request.format == Mime::XML - send_file(trace.xml_file, :filename => "#{trace.id}.xml", :type => Mime::XML.to_s, :disposition => 'attachment') + if request.format == Mime::XML or request.format == Mime::GPX + send_file(trace.xml_file, :filename => "#{trace.id}.xml", :type => request.format.to_s, :disposition => 'attachment') else send_file(trace.trace_name, :filename => "#{trace.id}#{trace.extension_name}", :type => trace.mime_type, :disposition => 'attachment') end diff --git a/app/models/trace.rb b/app/models/trace.rb index 5e609786d..1553c894b 100644 --- a/app/models/trace.rb +++ b/app/models/trace.rb @@ -112,7 +112,7 @@ class Trace < ActiveRecord::Base elsif zipped mimetype = "application/x-zip" else - mimetype = "text/xml" + mimetype = "application/gpx+xml" end return mimetype