From 7e1d9b8910a0023dea2d28f7c1340da3167b409b Mon Sep 17 00:00:00 2001 From: Thomas Date: Fri, 6 Jan 2023 15:57:05 +0100 Subject: [PATCH] Fix issue #730 --- .../main/java/app/fedilab/android/jobs/ComposeWorker.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/app/fedilab/android/jobs/ComposeWorker.java b/app/src/main/java/app/fedilab/android/jobs/ComposeWorker.java index 6637c03cc..f66b8ca3b 100644 --- a/app/src/main/java/app/fedilab/android/jobs/ComposeWorker.java +++ b/app/src/main/java/app/fedilab/android/jobs/ComposeWorker.java @@ -270,7 +270,11 @@ public class ComposeWorker extends Worker { b.putBoolean(Helper.RECEIVE_COMPOSE_ERROR_MESSAGE, true); Intent intentBD = new Intent(Helper.INTENT_COMPOSE_ERROR_MESSAGE); b.putSerializable(Helper.ARG_STATUS_DRAFT, dataPost.statusDraft); - b.putSerializable(Helper.RECEIVE_ERROR_MESSAGE, statusResponse.errorBody().string()); + String err = statusResponse.errorBody().string(); + if (err.contains("{\"error\":\"")) { + err = err.replaceAll("\\{\"error\":\"(.*)\"}", "$1"); + } + b.putSerializable(Helper.RECEIVE_ERROR_MESSAGE, err); intentBD.putExtras(b); LocalBroadcastManager.getInstance(context).sendBroadcast(intentBD); return;