From b118e40f7204d6cba3bc39cfbad0566c810110ec Mon Sep 17 00:00:00 2001 From: fbt Date: Sun, 5 Jul 2015 17:14:27 +0300 Subject: [PATCH] rm didn't work if the file was already uploaded --- sup | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/sup b/sup index d9dbcbd..e80378c 100755 --- a/sup +++ b/sup @@ -88,7 +88,7 @@ sup.upload() { if ! (( $? )); then printf '%s\n' "$file_url" else - if curl -sL \ + curl -sL \ -F file="@$file" \ -F upload_mode='api' \ -F flag_private="$flag_private" \ @@ -98,14 +98,15 @@ sup.upload() { -F submit="" \ -A 'zerofiles.org upload script' \ "$cfg_service_url/upload" - then - if (( flag_rm )); then - sup.msg "Removing file: $file" - rm "$file" - fi - else - sup.err 'Something has gone wrong with the upload.' - return 7 + fi + + if (( $? )); then + sup.err 'Something has gone wrong with the upload.' + return 7 + else + if (( flag_rm )); then + sup.msg "Removing file: $file" + rm "$file" fi fi }