]> Pileus Git - vpaste/blobdiff - index.cgi
no-text test
[vpaste] / index.cgi
index 3ed58033ad097eba58bbb9b88d7ae4a5adf19853..3af8810961d4096689680c3142b7d2155be0249c 100755 (executable)
--- 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