From: Andy Spencer Date: Sat, 10 Oct 2009 13:23:27 +0000 (+0000) Subject: no-text test X-Git-Url: http://pileus.org/git/?p=vpaste;a=commitdiff_plain;h=557c2700a9f8cbf77e1f8bb20f0d3350cf7024ed no-text test --- diff --git a/index.cgi b/index.cgi index 3ed5803..3af8810 100755 --- a/index.cgi +++ b/index.cgi @@ -92,7 +92,13 @@ function do_print { function do_upload { output="$(mktemp db/XXXXX)" uri="$url$(basename "$output")${QUERY_STRING:+"?"}" - (get_modeline; cut_file "$1") > "$output" + text=$(cut_file "$1") + if [ -z "$text" ]; then + header text/plain + echo "No text pasted" + exit + fi + (get_modeline; echo "$text") > "$output" echo "Status: 302 Found" echo "Location: $uri" header text/plain