Migrate to marcel instead of mimemagic
keymastervn opened this issue ยท 4 comments
The using of mimemagic requires to install Freedesktop.org 's shared-mime-info
dependency which is not a no brainer solution.
My proposal is changing filestack-ruby
from using mimemagic
to marcel
as a dependency.
https://github.com/rails/marcel/releases/tag/v1.0.0
The concern when switching is that mimemagic
can broadly support more mime-types than marcel
. Should we add more tests to cover supported mimes instead of just image/jpeg?
@keymastervn Thank you for sharing the idea. I'll take a look on that asap, because as you notice I have to update ruby version to use this gem and add some tests.
+1 for getting this changed. Activestorage replaced mimemagic with mini_magic several weeks ago in rails/rails@62ac25a#diff-eec2338fdef55a927e74bdde44f4cd18b6717916113089c3279dee8e790c632f.
With the current mimemagic dependency, filestack-ruby is an extremely large dependency, this is after the gem is required in my Rails application:
filestack: 67.1914 MiB
filestack/models/filelink: 67.1875 MiB (Also required by: filestack/models/filestack_av)
filestack/utils/utils: 66.418 MiB (Also required by: filestack/models/filestack_av, filestack/mixins/filestack_common, and 3 others)
mimemagic: 66.418 MiB (Also required by: filestack/utils/multipart_upload_utils, filestack/mixins/filestack_common)
Compared to rails/all: 57.75 MiB
, filestack-ruby has a larger footprint than rails itself!
Furthermore, I'd be happy to change the implementation from marcel
to mini_mime
(which marcel is built upon)
if we need more performance over community support
This couldn't be backported to ruby 2.1 and lowers (EOL), I think it's time to bump to 3.0, we can still maintain 2.9 on critical bugs or security issues for some periods of time.
@PhilCoggins @keymastervn I've replaced mimemagic
with mini_mime
. Let me know if all good now.