X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/a41d500b9f65ec9f4e848effd38dc1ae117e7594..64b3e289ac14533c6fb2b1223b6417ad0446878c:/app/models/trace.rb diff --git a/app/models/trace.rb b/app/models/trace.rb index d500784af..959d82e1c 100644 --- a/app/models/trace.rb +++ b/app/models/trace.rb @@ -117,7 +117,7 @@ class Trace < ApplicationRecord end def mime_type - filetype = `/usr/bin/file -Lbz #{trace_name}`.chomp + filetype = Open3.capture2("/usr/bin/file", "-Lbz", trace_name).first.chomp gzipped = filetype =~ /gzip compressed/ bzipped = filetype =~ /bzip2 compressed/ zipped = filetype =~ /Zip archive/ @@ -139,7 +139,7 @@ class Trace < ApplicationRecord end def extension_name - filetype = `/usr/bin/file -Lbz #{trace_name}`.chomp + filetype = Open3.capture2("/usr/bin/file", "-Lbz", trace_name).first.chomp gzipped = filetype =~ /gzip compressed/ bzipped = filetype =~ /bzip2 compressed/ zipped = filetype =~ /Zip archive/ @@ -208,8 +208,7 @@ class Trace < ApplicationRecord end def xml_file - # TODO: *nix specific, could do to work on windows... would be functionally inferior though - check for '.gz' - filetype = `/usr/bin/file -Lbz #{trace_name}`.chomp + filetype = Open3.capture2("/usr/bin/file", "-Lbz", trace_name).first.chomp gzipped = filetype =~ /gzip compressed/ bzipped = filetype =~ /bzip2 compressed/ zipped = filetype =~ /Zip archive/