X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/16358a1d39d96a2d04ab410731c9edcdf155606b..44051f30d8a65a49a8db020bedefa632a446c666:/app/models/trace.rb diff --git a/app/models/trace.rb b/app/models/trace.rb index ed0ba72e8..3eefc185d 100644 --- a/app/models/trace.rb +++ b/app/models/trace.rb @@ -3,6 +3,7 @@ class Trace < ActiveRecord::Base validates_presence_of :user_id, :name, :timestamp validates_presence_of :description, :on => :create + validates_format_of :tagstring, :with => /^[^\/;.,?]*$/ # validates_numericality_of :latitude, :longitude validates_inclusion_of :public, :inserted, :in => [ true, false] @@ -73,7 +74,7 @@ class Trace < ActiveRecord::Base end def mime_type - filetype = `file -bz #{trace_name}`.chomp + filetype = `/usr/bin/file -bz #{trace_name}`.chomp gzipped = filetype =~ /gzip compressed/ bzipped = filetype =~ /bzip2 compressed/ zipped = filetype =~ /Zip archive/ @@ -92,7 +93,7 @@ class Trace < ActiveRecord::Base end def extension_name - filetype = `file -bz #{trace_name}`.chomp + filetype = `/usr/bin/file -bz #{trace_name}`.chomp gzipped = filetype =~ /gzip compressed/ bzipped = filetype =~ /bzip2 compressed/ zipped = filetype =~ /Zip archive/ @@ -141,7 +142,7 @@ class Trace < ActiveRecord::Base logger.info("GPX Import importing #{name} (#{id}) from #{user.email}") # TODO *nix specific, could do to work on windows... would be functionally inferior though - check for '.gz' - filetype = `file -bz #{trace_name}`.chomp + filetype = `/usr/bin/file -bz #{trace_name}`.chomp gzipped = filetype =~ /gzip compressed/ bzipped = filetype =~ /bzip2 compressed/ zipped = filetype =~ /Zip archive/ @@ -188,7 +189,6 @@ class Trace < ActiveRecord::Base tp.lng = point['longitude'].to_f tp.altitude = point['altitude'].to_f tp.timestamp = point['timestamp'] - tp.user_id = user.id tp.gpx_id = id tp.trackid = point['segment'].to_i tp.save!