summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xssn.at>2010-10-29 20:30:26 +0200
committerFlorian Pritz <bluewind@xssn.at>2010-10-29 20:30:26 +0200
commit71f58b274b4a13771c52c987f2ef58d9be59f68f (patch)
tree2c055d41dd1e95c130d10847760cde32e5bc1d9a
parentcdf7eda32ff3e9bb4133b813e077480b25693dc9 (diff)
fix handling of files beginning with a dash (-)v0.6.8.5
Signed-off-by: Florian Pritz <bluewind@xssn.at>
-rwxr-xr-xfb20
1 files changed, 10 insertions, 10 deletions
diff --git a/fb b/fb
index 7d5077c..66206e1 100755
--- a/fb
+++ b/fb
@@ -34,20 +34,20 @@ EXITCODE=0
do_upload() {
local EXTRA=""
file="$1"
- basefilename="`basename "$file"`"
- basedirname="`dirname "$file"`"
+ basefilename="`basename -- "$file"`"
+ basedirname="`dirname -- "$file"`"
if [ -d "$file" ]; then
cd "$basedirname"
- tar $TAROPTS -cf "$TMPDIR/$basefilename$TAREXT" "$basefilename"
+ tar $TAROPTS -cf "$TMPDIR/$basefilename$TAREXT" -- "$basefilename"
COMPRESS=0
file="$TMPDIR/$basefilename$TAREXT"
fi
if [ "$COMPRESS" == "1" ]; then
- gzip -c "$file" > "$TMPDIR/$basefilename.gz"
+ gzip -c -- "$file" > "$TMPDIR/$basefilename.gz"
file="$TMPDIR/$basefilename.gz"
elif [ "$COMPRESS" == "2" ]; then
- xz -c "$file" > "$TMPDIR/$basefilename.xz"
+ xz -c -- "$file" > "$TMPDIR/$basefilename.xz"
file="$TMPDIR/$basefilename.xz"
fi
@@ -55,16 +55,16 @@ do_upload() {
EXTRA="-F extension=$EXTENSION"
fi
TMPFILE=`mktemp "$TMPDIR/data.XXXXXX"`
- if [ `stat -c %s "$file"` -gt "$WARNSIZE" ]; then
+ if [ `stat -c %s -- "$file"` -gt "$WARNSIZE" ]; then
WARNSIZE=`curl -s "$PASTEBIN/file/get_max_size"`
- if [ `stat -c %s "$file"` -gt "$WARNSIZE" ]; then
+ if [ `stat -c %s -- "$file"` -gt "$WARNSIZE" ]; then
echo "Warning: Your upload is too big and would be rejected. Maximum size is: $WARNSIZE bytes. Skipping..." >&2
EXITCODE=1
return 1
fi
fi
CURLOPTS="-# -n -L -A $USERAGENT $EXTRA"
- if [ `stat -c %s "$file"` -eq "0" ]; then
+ if [ `stat -c %s -- "$file"` -eq "0" ]; then
if ! curl $CURLOPTS -F "file=@-;filename=$basefilename" "$PASTEBIN/file/do_upload" < "$file" > $TMPFILE; then
EXITCODE=1
return 1
@@ -139,7 +139,7 @@ if [ $# -eq 0 ]; then
do_upload "$TMPDIR/stdin"
else
if [ "$TAR" ]; then
- tar $TAROPTS -cf "$TMPDIR/upload$TAREXT" "$@"
+ tar $TAROPTS -cf "$TMPDIR/upload$TAREXT" -- "$@"
COMPRESS=0
do_upload "$TMPDIR/upload$TAREXT"
break
@@ -160,7 +160,7 @@ else
continue
fi
for f in *; do
- do_upload "$f" && rm -f "$f"
+ do_upload "$f" && rm -f -- "$f"
done
else
do_upload "$i"