Use libmagic via majic
This removes Pleroma.MIME
and use majic (my fork of gen_magic). This adds a new dependency: libmagic-devel (or file-devel depending on the OS).
Controller that deals with uploads now need to plug Majic.Plug
which validates content-type and filename with libmagic. Pleroma.Upload
no detect the content-type with a Plug.Upload
, only when a base64
string is given.
I've tested majic on Ubuntu, Debian, Voidlinux, FreeBSD, macOS, Alpine. Still to do is Net/Open BSD. Also tested it with valgrind and on long running tests.
The majic fork adds a more robust C port (I guess), uses ei.h
, support for passing bytes instead of a file, pooling with nimble_pool, makes it work on musl-based distributions, adds a Plug, and an improved error handling (at the C level and at the Elixir level).
-
Update docs -
Check NetBSD/OpenBSD -
Check CI release builds
Closes #1736 (closed) (cc #1290 (closed), #786 (closed), #654 (closed), #621 (closed)).