X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/07e84496255ebd1d53108894e0fb8ce98b55ccee..7151fa05e4d4f73956d7f9a7ad2db1f5b956a0c0:/app/models/trace.rb?ds=sidebyside diff --git a/app/models/trace.rb b/app/models/trace.rb index fef9983dd..0e9e7bcc1 100644 --- a/app/models/trace.rb +++ b/app/models/trace.rb @@ -145,23 +145,25 @@ class Trace < ActiveRecord::Base tarred = filetype =~ /tar archive/ if gzipped or bzipped or zipped or tarred then - file = Tempfile.new("trace.#{id}"); + tmpfile = Tempfile.new("trace.#{id}"); if tarred and gzipped then - system("tar -zxOf #{trace_name} > #{file.path}") + system("tar -zxOf #{trace_name} > #{tmpfile.path}") elsif tarred and bzipped then - system("tar -jxOf #{trace_name} > #{file.path}") + system("tar -jxOf #{trace_name} > #{tmpfile.path}") elsif tarred - system("tar -xOf #{trace_name} > #{file.path}") + system("tar -xOf #{trace_name} > #{tmpfile.path}") elsif gzipped - system("gunzip -c #{trace_name} > #{file.path}") + system("gunzip -c #{trace_name} > #{tmpfile.path}") elsif bzipped - system("bunzip2 -c #{trace_name} > #{file.path}") + system("bunzip2 -c #{trace_name} > #{tmpfile.path}") elsif zipped - system("unzip -p #{trace_name} > #{file.path}") + system("unzip -p #{trace_name} > #{tmpfile.path}") end - file.unlink + tmpfile.unlink + + file = tmpfile.file else file = File.open(trace_name) end @@ -189,6 +191,7 @@ class Trace < ActiveRecord::Base if first f_lat = point['latitude'] f_lon = point['longitude'] + first = false end tp = Tracepoint.new