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 Aug 8, 2024
1 parent ac60e1e commit aad2b39
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions qubes-rpc/qvm-open-in-vm
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ if [ -z "$target" ] || [ -z "$filename" ]; then
usage
fi

if [ -d "$filename" ]; then
printf 'Error! "%s" is a directory.\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 aad2b39

Please sign in to comment.