X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/88ba316abeecffccd1cb51c63ce5594c95023624..6ede9e3ec74e89dc61b48c52b439a6581dfde80e:/lib/gpx.rb?ds=inline 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