Closed d00ML0rDz closed 2 years ago
Database with file signatures magic.mgc should be placed along with libmagic-1.so(/bin/ or runtimes/linux-x64/native/ directories). It depends on how you publish the application.
Also, it can be set via setter MimeGuesser.MagicFilePath:
MimeGuesser.MagicFilePath = "/path/to/magic/file/magic.mgc";
But it seems like you are use 3.3.0 version. So, try to install latest package, it should works out of box.
The base NsfwSpy project is just a class library so when I either publish or pack it, the magic.mgc and libmagic-1.so files aren't being included in the .nupkg file or the release folders. However when adding the NsfwSpy package to a project (e.g. an empty console application), the Mime package also gets installed due to being a dependency.
In that test console app, I can see the magic.gc and libmagic-1.so files in the ConsoleApp/bin/Debug/net6.0/runtimes/linux-x64/native/ folder. So not quite sure why Mime isn't picking them up.
This is because before 3.4.0 library check database only inside directory where is Mime.dll placed. In latest version it search magic.mgc inside runtime/{RID}/native too. This should be cover situations when application published without specify target runtime.
Cool, I'll have a go with 3.4.0 and see how it goes. Thanks for the help so far.
Yep, version 3.4.0 fixed it. Sorry for not trying this to start with.
Thanks for the help!
I've included the Mime package as part of my own Nuget package NsfwSpy, but when I run the following lines of code I get the error message "Could not find any valid magic files!" on my fresh Ubuntu VM.
Is there something I need to do to include the libmagic dependency in my Nuget package?