X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/2ecfd61ee9e7f1905638474b98b14b5597409fe6..1a11c4dc191d93b18fcf5aa917448c8cd6d2556b:/lib/gpx.rb diff --git a/lib/gpx.rb b/lib/gpx.rb index d0607233a..71b2823b8 100644 --- a/lib/gpx.rb +++ b/lib/gpx.rb @@ -44,13 +44,13 @@ module GPX @tracksegs = 0 begin - Archive::Reader.open_filename(@file).each_entry_with_data do |_entry, data| - parse_file(XML::Reader.string(data), &block) + Archive::Reader.open_filename(@file).each_entry_with_data do |entry, data| + parse_file(XML::Reader.string(data), &block) if entry.regular? end rescue Archive::Error io = ::File.open(@file) - case MimeMagic.by_magic(io)&.type + case Marcel::MimeType.for(io) when "application/gzip" then io = Zlib::GzipReader.open(@file) when "application/x-bzip" then io = Bzip2::FFI::Reader.open(@file) end