Skip to content

Commit

Permalink
Accept only files for qvm-open-in-(d)vm
Browse files Browse the repository at this point in the history
  • Loading branch information
alimirjamali committed Jul 19, 2024
1 parent ac60e1e commit e17c186
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions qubes-rpc/qvm-open-in-vm
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,21 @@ if [ -z "$target" ] || [ -z "$filename" ]; then
usage
fi

if [ -d "$filename" ]; then
printf 'Error! "%s" is a directory.\n' "$filename"
usage
elif [ -L "$filename" ]; then
printf 'Error! "%s" is a symlink.\n' "$filename"
usage
elif [ ! -f "$filename" ]; then
expr "@$filename" : '@[A-Za-z][A-Za-z0-9+]*://'>/dev/null
# shellcheck disable=SC2181
if [ $? -ne 0 ]; then
printf 'Error! "%s" is not a valid file or URL.\n' "$filename"
usage
fi
fi

prompt_text='Are you sure you want to create another disposable VM?'
case $target in
(@dispvm|@dispvm:*)
Expand Down

0 comments on commit e17c186

Please sign in to comment.