yadus: use --data-urlencode

Fix ampersand and other special characters' problems
This commit is contained in:
Théophile Bastian 2017-06-15 12:10:27 +02:00
parent 3dec79668f
commit 191fa21369
2 changed files with 4 additions and 3 deletions

View file

@ -5,10 +5,11 @@ YADUS_URL="https://tiny.tobast.fr/+submit"
if [ "$#" -lt "1" ]; then
url=$(/usr/bin/dmenu -p "Url to shorten" < /dev/null) || exit 1
else
url=$1
url="$1"
fi
curl_out=$(/usr/bin/curl -sw '\n%{http_code}' -X POST -d url="$url" "$YADUS_URL")
curl_out=$(/usr/bin/curl -sw '\n%{http_code}' -X POST \
--data-urlencode url="$url" "$YADUS_URL")
http_code=$(echo -e "$curl_out" | tail -n 1)
http_body=$(echo -e "$curl_out" | head -n -1)

View file

@ -1,6 +1,6 @@
#!/bin/bash
clip_content=$(/usr/bin/xclip -selection clipboard -out)
clip_content="$(/usr/bin/xclip -selection clipboard -out)"
if [ -z "$clip_content" ]; then
exit 1
fi