summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBo Ørsted Andresen <bo.andresen@zlin.dk>2008-11-06 20:01:16 +0100
committerBo Ørsted Andresen <bo.andresen@zlin.dk>2008-11-06 20:01:16 +0100
commite78cc197dc3cc9e67f2d7d8fafb3f86812772b80 (patch)
tree6e71872e5d06f5fe9bb9c6ec2e2e4f01ab3e2d0e
parent41c28aba9ac95984a67637180dc0daa481257384 (diff)
downloadwgetpaste-e78cc197dc3cc9e67f2d7d8fafb3f86812772b80.tar.gz
dpaste fails when the description is over 50 bytes.
-rwxr-xr-xwgetpaste9
1 files changed, 9 insertions, 0 deletions
diff --git a/wgetpaste b/wgetpaste
index d260489..5a544a0 100755
--- a/wgetpaste
+++ b/wgetpaste
@@ -22,6 +22,7 @@ SIZE_ca="1024000 1%MB"
# dpaste
ENGINE_dpaste=dpaste
URL_dpaste="http://dpaste.com/"
+DESCRIPTION_SIZE_dpaste="50"
DEFAULT_EXPIRATION_dpaste="30 days"
# rafb
ENGINE_rafb=rafb
@@ -616,6 +617,7 @@ else
fi
# set default description
+size=DESCRIPTION_SIZE_$SERVICE
if [[ -z $DESCRIPTION ]]; then
case "$SOURCE" in
info )
@@ -634,6 +636,13 @@ if [[ -z $DESCRIPTION ]]; then
DESCRIPTION="$SOURCE"
;;
esac
+ if [[ -n ${!size} && ${#DESCRIPTION} -gt ${!size} ]]; then
+ DESCRIPTION="${DESCRIPTION: -${!size}}"
+ fi
+else
+ if [[ -n ${!size} && ${#DESCRIPTION} -gt ${!size} ]]; then
+ die "The description for this pastebin service can be at most ${!size} bytes. You specified a description of ${#DESCRIPTION} bytes."
+ fi
fi
# create tmpfile for use with tee