close issue #1 by properly handling " and ' characters
parent
a6feb5618d
commit
ca894cd1ca
|
@ -77,9 +77,14 @@ FEED: foreach my $feed (@feeds){
|
|||
$status =~ s/{Modified}/$entry{modified}/g;
|
||||
$status =~ s/{Tags}/$entry{tags}/g;
|
||||
|
||||
$status =~ s/'/'\\''/g;
|
||||
my %data;
|
||||
if (length($status) > 500){
|
||||
$status =~ s/^(.{497}).*$/\1.../g;
|
||||
}
|
||||
$data{status} = $status;
|
||||
$ENV{status} = encode_json({%data});
|
||||
|
||||
open(DATA, "./post_status.bash '$user->{data}->{access_token}' '$user->{data}->{instance}' '$status'|");
|
||||
open(DATA, "./post_status.bash '$user->{data}->{access_token}' '$user->{data}->{instance}' |");
|
||||
my $reply = "";
|
||||
{
|
||||
local $/ = undef;
|
||||
|
|
|
@ -1,9 +1,3 @@
|
|||
#!/bin/bash
|
||||
#!/bin/bash -x
|
||||
|
||||
status="${3}"
|
||||
if [[ -n "${status:500}" ]]; then
|
||||
status="${status:0:496}..."
|
||||
fi
|
||||
|
||||
curl -sS -X POST --header "Authorization: Bearer ${1}" "${2}/api/v1/statuses" -d "status=${status}" 2>/dev/null
|
||||
#https://cloud.digitalocean.com/v1/oauth/token?client_id=CLIENT_ID&client_secret=CLIENT_SECRET&grant_type=authorization_code&code=AUTHORIZATION_CODE&redirect_uri=CALLBACK_URL
|
||||
echo "${status}" | curl -sS -X POST --header "Authorization: Bearer ${1}" --header "Content-Type: application/json;charset=utf-8" "${2}/api/v1/statuses" -d@- 2>/dev/null
|
||||
|
|
Loading…
Reference in New Issue