summaryrefslogtreecommitdiffstats
path: root/fb.in
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2012-04-04 18:17:44 +0200
committerFlorian Pritz <bluewind@xinu.at>2012-04-04 18:17:44 +0200
commit3713529f5a1b05c56526a55610ef3cf5dccb585e (patch)
tree3bcc6d8e8c961980a567a8a17de4bdab2f4f8886 /fb.in
parentdc4822837ccfac9d1f100f8e0e5d59910121ca95 (diff)
Error on 0-byte files
No point in uploading a really empty file and it might even cause confusion to see an empty page when clicking the link. Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'fb.in')
-rw-r--r--fb.in4
1 files changed, 4 insertions, 0 deletions
diff --git a/fb.in b/fb.in
index 7d47ee8..0380777 100644
--- a/fb.in
+++ b/fb.in
@@ -69,6 +69,10 @@ request_helper() {
if [ "$mode" = "u" ]; then
basefilename=`basename -- "$file"`
if [ "`$STAT -- "$file"`" -eq "0" ] || echo "$basefilename" | grep -F -q ","; then
+ if [ "`wc -c -- "$file" | cut -d\ -f1`" -eq "0" ]; then
+ echo "Error: skipping 0-byte file: \"$file\"" >&2
+ return 1
+ fi
base64fn="`base64_encode "$basefilename"`"
curl $CURLOPTS -F "file=@-" -F "filename=$base64fn" "$url" < "$file" -o /dev/stdout
else