From 73143dd69b6e67ebacb5f8ed393ad7218553d59a Mon Sep 17 00:00:00 2001 From: VG Date: Mon, 1 Dec 2014 14:30:43 +0100 Subject: fix length limitation and encoding with pasteme script --- scripts/pasteme | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'scripts') diff --git a/scripts/pasteme b/scripts/pasteme index fe1f720..c6b9d3f 100755 --- a/scripts/pasteme +++ b/scripts/pasteme @@ -1,12 +1,8 @@ #!/bin/bash - -file="$1" - -if [ "$file" == "" ]; then - file=- -fi - -sed '1s/^/content=/' "$file" \ - | curl -w '%{redirect_url}\n' \ - -X POST -H "Content-Type: text/plain; charset=UTF-8" \ - --data-binary @- http://paste.devys.org/ +tempfile="$(mktemp)" +cat "${1:--}" > $tempfile +curl -w '%{redirect_url}\n' --data-urlencode content@$tempfile \ + http://paste.devys.org/ +rc=$? +rm $tempfile +exit $rc -- cgit v1.2.3