Use libmagic via majic
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