dshoreman / nextshot

A simple tool for taking screenshots on Linux and sharing via Nextcloud
GNU General Public License v2.0
42 stars 3 forks source link

Check MIME types for --file mode #21

Closed dshoreman closed 5 years ago

dshoreman commented 5 years ago

Goes without saying, really. We don't want to be blindly uploading a massive .tar.gz (for example) and disguising it as a png when it's clearly not.

At least until the main pipeline's been rewritten for better error handling, it'd be best to add the check within parse_opts(). We can use file --mime-type <FILEPATH> to check. Add the -b flag and it'll suppress the filename too, which we don't particularly need.