aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVG <vg@devys.org>2014-12-01 14:30:43 +0100
committerVG <vg@devys.org>2014-12-01 14:30:43 +0100
commit73143dd69b6e67ebacb5f8ed393ad7218553d59a (patch)
tree93f2513e94199972d5f355466311602fa223c5ef
parentc211fa9bda27e879508e25826965fe36e3665872 (diff)
downloadpasteme-73143dd69b6e67ebacb5f8ed393ad7218553d59a.tar.gz
pasteme-73143dd69b6e67ebacb5f8ed393ad7218553d59a.tar.bz2
pasteme-73143dd69b6e67ebacb5f8ed393ad7218553d59a.zip
fix length limitation and encoding with pasteme script
-rwxr-xr-xscripts/pasteme18
1 files changed, 7 insertions, 11 deletions
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