dshoreman / nextshot

A simple tool for taking screenshots on Linux and sharing via Nextcloud

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

File path checking is unreliable

dshoreman opened this issue · comments

Currently the --file mode checks for the given file relative to $PWD. This is fine when the image is in the same directory, and probably even up a level or two.

However, issues start to arise when passing root-relative paths or paths that go via a symlink. For instance, the following fails:

nextshot --file ~/pictures/kitten.jpg

because it's looking for /home/$USER/pictures/kitten.jpg when actually pictures is a symlink to /var/run/media/$USER/data/pictures.

May be able to make use of the -E flag on the file command when we're checking MIME types, replacing the file existence check entirely. Will need to play about and try some things to see.