detect download filetype
fixes #4