1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/haste_ynh.git synced 2024-09-03 20:36:28 +02:00

Fix haste command

This commit is contained in:
mbugeia 2016-10-26 00:37:22 +02:00
parent 2c0f85715b
commit 5713c40336

View file

@ -1,8 +1,6 @@
#!/bin/bash
set -eu
PASTE_URL="https://YNH_HASTE_URL"
PASTE_URL="YNH_HASTE_URL"
haste () {
local output returnfile contents
@ -33,10 +31,10 @@ haste () {
then
contents=$(cat $1)
fi
output=$(curl -# -f -XPOST "http://"${PASTE_URL}"/documents" -d"$contents")
output=$(curl -# -f -k -XPOST "https://"${PASTE_URL}"/documents" -d"$contents")
if (( $? == 0 )) && [[ $output =~ \"key\" ]]
then
returnfile=$(sed 's/^.*"key":"/http:\/\/'${PASTE_URL}'\//;s/".*$//' <<< "$output")
returnfile=$(sed 's/^.*"key":"/https:\/\/'${PASTE_URL}'\//;s/".*$//' <<< "$output")
if [[ -n $returnfile ]]
then
echo "$returnfile"