yadus: use --data-urlencode
Fix ampersand and other special characters' problems
This commit is contained in:
parent
3dec79668f
commit
191fa21369
2 changed files with 4 additions and 3 deletions
|
@ -5,10 +5,11 @@ YADUS_URL="https://tiny.tobast.fr/+submit"
|
||||||
if [ "$#" -lt "1" ]; then
|
if [ "$#" -lt "1" ]; then
|
||||||
url=$(/usr/bin/dmenu -p "Url to shorten" < /dev/null) || exit 1
|
url=$(/usr/bin/dmenu -p "Url to shorten" < /dev/null) || exit 1
|
||||||
else
|
else
|
||||||
url=$1
|
url="$1"
|
||||||
fi
|
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_code=$(echo -e "$curl_out" | tail -n 1)
|
||||||
http_body=$(echo -e "$curl_out" | head -n -1)
|
http_body=$(echo -e "$curl_out" | head -n -1)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
clip_content=$(/usr/bin/xclip -selection clipboard -out)
|
clip_content="$(/usr/bin/xclip -selection clipboard -out)"
|
||||||
if [ -z "$clip_content" ]; then
|
if [ -z "$clip_content" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue