Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept only files for qvm-open-in-(d)vm #513

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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