From c94d2d798c5a15550c0804d2884380b87b4330dc Mon Sep 17 00:00:00 2001 From: Danielzxccc Date: Thu, 28 Dec 2023 23:52:21 +0800 Subject: [PATCH] fix: image source for question viewing --- src/modules/Forums/ForumsInteractor.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/modules/Forums/ForumsInteractor.ts b/src/modules/Forums/ForumsInteractor.ts index 7a195f7..595f6e0 100644 --- a/src/modules/Forums/ForumsInteractor.ts +++ b/src/modules/Forums/ForumsInteractor.ts @@ -37,7 +37,14 @@ export async function viewQuestion( if (!data) throw new HttpError('Question Not Found', 404) - const formattedQuestion = await replaceAvatarsWithUrls(data) + const dataWithImageSrc = data.imagesrc.map((item, _) => { + return getObjectUrl(item) + }) + + const formattedQuestion = await replaceAvatarsWithUrls({ + ...data, + imagesrc: dataWithImageSrc, + }) return { data: formattedQuestion, total } }