qvm-open-in-vm: escape URL when wrapping it in HTML

Thanks @v6ak for the report and solution.

Fixes QubesOS/qubes-issues#1462
This commit is contained in:
Marek Marczykowski-Górecki 2016-05-17 22:06:41 +02:00
parent 817606a09d
commit ff2678d2f5
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -6,9 +6,10 @@ wrap_in_html_if_url()
*://*)
FILE_ARGUMENT=$(mktemp)
echo -n '<html><meta HTTP-EQUIV="REFRESH" content="0; url=' > $FILE_ARGUMENT
echo -n "$1" >> $FILE_ARGUMENT
echo '"></html>' >> $FILE_ARGUMENT
echo -n '<html><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>'
echo -n '<meta HTTP-EQUIV="REFRESH" content="0; url=' > $FILE_ARGUMENT
echo -n "$1" | sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g; s/"/\&quot;/g; s/'"'"'/\&#39;/g' >> $FILE_ARGUMENT
echo '"/></html>' >> $FILE_ARGUMENT
;;
*)
FILE_ARGUMENT="$1"