]> git.openstreetmap.org Git - rails.git/commitdiff
Switch GPX MIME type detection to use marcel
authorTom Hughes <tom@compton.nu>
Tue, 30 Mar 2021 17:26:23 +0000 (18:26 +0100)
committerTom Hughes <tom@compton.nu>
Tue, 30 Mar 2021 17:26:23 +0000 (18:26 +0100)
Gemfile
Gemfile.lock
lib/gpx.rb

diff --git a/Gemfile b/Gemfile
index a49db0e7bf3c1ccbf652d50b4aa15afcbbe5dc2e..7e9be257b4969997204625b53ff787390dc008cc 100644 (file)
--- 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"
index c7f8126c437bff6700fdc547705070720ec683ce..8bcc99a765c562dddc31794cd8968d29b9b310fa 100644 (file)
@@ -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)
index 86cf2f49dab377fcaccde84920866430af8ffbc2..71b2823b85c16a38689987de8fd01a2c97533b1f 100644 (file)
@@ -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