From 9d98c7e63aa25a167041550b8bd1c77f0e508686 Mon Sep 17 00:00:00 2001 From: Vavassor Date: Sun, 2 Jul 2017 17:55:18 -0400 Subject: [PATCH] Fixes bug where "The upload failed." error message shows up when media upload is canceled intentionally. --- .../java/com/keylesspalace/tusky/ComposeActivity.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java index 7dc23abf..e8e62798 100644 --- a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java @@ -1044,8 +1044,8 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm @Override public void onFailure(Call call, Throwable t) { - Log.d(TAG, t.getMessage()); - onUploadFailure(item, false); + Log.d(TAG, "Upload request failed. " + t.getMessage()); + onUploadFailure(item, call.isCanceled()); } }); } @@ -1079,7 +1079,10 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm if (finishingUploadDialog != null) { finishingUploadDialog.cancel(); } - removeMediaFromQueue(item); + if (!isCanceled) { + // If it is canceled, it's already been removed, otherwise do it. + removeMediaFromQueue(item); + } } private void cancelReadyingMedia(QueuedMedia item) {