X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/3db4ac9a8e8dd94bc288e98ff353452e401d0a59..6ae23bed90f249ed943cc43f1bad0e40852f04bb:/app/controllers/trace_controller.rb diff --git a/app/controllers/trace_controller.rb b/app/controllers/trace_controller.rb index 7c5bd7db0..4db6e8e15 100644 --- a/app/controllers/trace_controller.rb +++ b/app/controllers/trace_controller.rb @@ -121,7 +121,11 @@ class TraceController < ApplicationController trace = Trace.find(params[:id]) if trace.visible? and (trace.public? or (@user and @user == trace.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, :status => :not_found end @@ -297,7 +301,7 @@ private @trace.timestamp = Time.now if @trace.save - File.rename(filename, @trace.trace_name) + FileUtils.mv(filename, @trace.trace_name) else FileUtils.rm_f(filename) end