]> gitweb.fluxo.info Git - scripts.git/commitdiff
Fix: scuttle: use urlencode from curl
authorSilvio Rhatto <rhatto@riseup.net>
Wed, 10 Feb 2021 23:00:59 +0000 (20:00 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Wed, 10 Feb 2021 23:00:59 +0000 (20:00 -0300)
scuttle

diff --git a/scuttle b/scuttle
index cb94ae154a0b790b7f7b99c39a15f23fc9964d9b..9c2d9fac09dfb61643afa81fe8fc19b436e3976f 100755 (executable)
--- a/scuttle
+++ b/scuttle
@@ -39,13 +39,14 @@ fi
 source "$HOME/.custom/scuttle" || exit 1
 
 # See http://www.wired.com/2010/02/using_the_delicious_api/
-CALL="$SCUTTLE_URL/api/posts/add?url=`urlencode $URL`"
+#CALL="$SCUTTLE_URL/api/posts/add?url=`urlencode $URL`"
+CALL="$SCUTTLE_URL/api/posts/add"
 
 # Tags
 TAGS="`echo $TAGS | sed -e 's/,/ /g'`"
-TAGS="`urlencode "$TAGS"`"
+#TAGS="`urlencode "$TAGS"`"
 TAGS="`echo $TAGS | sed -e 's/%2C/,/g'`"
-CALL="$CALL&tags=$TAGS"
+#CALL="$CALL&tags=$TAGS"
 
 # Description
 if [ -z "$DESC" ]; then
@@ -55,7 +56,7 @@ if [ -z "$DESC" ]; then
 fi
 
 # Full API call
-CALL="$CALL&description=`urlencode "$DESC"`"
+#CALL="$CALL&description=`urlencode "$DESC"`"
 
 # Write config
 CONF="`mktemp -t scuttle.XXXXXXXXXX -p $TMP`"
@@ -63,7 +64,9 @@ echo "url = $CALL" > $CONF
 echo "user = $SCUTTLE_USER:$SCUTTLE_PASS" >> $CONF
 
 # Call curl
-curl -s -K $CONF &> /dev/null
+# See https://stackoverflow.com/questions/296536/how-to-urlencode-data-for-curl-command#2027690
+#curl -s -K $CONF &> /dev/null
+curl -s -K $CONF -G --data-urlencode "url=$URL" --data-urlencode "tags=$TAGS" --data-urlencode "description=$DESC" &> /dev/null
 
 # Status
 STATUS="$?"