Fix for file encoding

Files with @ or spaces in the path / url were causing issues with the mime-type detection and with downloading. Fixes #45