From 7e364469ade21ed284ec147505951dfe5808582f Mon Sep 17 00:00:00 2001 From: Alexander Harding <2166114+aeharding@users.noreply.github.com> Date: Mon, 12 Aug 2024 22:47:31 -0500 Subject: [PATCH] Fix error message on lemm.ee image upload (#1586) --- src/services/lemmy.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/services/lemmy.ts b/src/services/lemmy.ts index 98ed8c9b86..65ed6e202b 100644 --- a/src/services/lemmy.ts +++ b/src/services/lemmy.ts @@ -50,7 +50,9 @@ export async function _uploadImage(client: LemmyHttp, image: File) { image: compressedImageIfNeeded as File, }); - if (!response.url) throw new Error(response.msg); + // lemm.ee uses response.message for error messages (e.g. account too new) + // eslint-disable-next-line @typescript-eslint/no-explicit-any + if (!response.url) throw new Error(response.msg ?? (response as any).message); return response; }