From 4a6b1e54a5b091badda7f149018b27981e807c49 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 30 Mar 2021 18:26:23 +0100 Subject: [PATCH] Switch GPX MIME type detection to use marcel --- Gemfile | 2 +- Gemfile.lock | 5 +---- lib/gpx.rb | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index a49db0e7b..7e9be257b 100644 --- a/Gemfile +++ b/Gemfile @@ -109,7 +109,7 @@ gem "logstasher" gem "bzip2-ffi" gem "ffi-libarchive" gem "gd2-ffij", ">= 0.4.0" -gem "mimemagic" +gem "marcel" # Used for browser detection gem "browser" diff --git a/Gemfile.lock b/Gemfile.lock index c7f8126c4..8bcc99a76 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -259,9 +259,6 @@ GEM marcel (1.0.0) maxminddb (0.1.22) method_source (1.0.0) - mimemagic (0.4.3) - nokogiri (~> 1) - rake mini_magick (4.11.0) mini_mime (1.0.3) mini_portile2 (2.5.0) @@ -512,8 +509,8 @@ DEPENDENCIES libxml-ruby (>= 2.0.5) listen logstasher + marcel maxminddb - mimemagic mini_magick minitest (~> 5.1) oauth-plugin (>= 0.5.1) diff --git a/lib/gpx.rb b/lib/gpx.rb index 86cf2f49d..71b2823b8 100644 --- a/lib/gpx.rb +++ b/lib/gpx.rb @@ -50,7 +50,7 @@ module GPX 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 -- 2.39.5