From 9f3b85527d41da82f9bceb24e14829f30fd31c71 Mon Sep 17 00:00:00 2001 From: Michcio Date: Sun, 25 Sep 2022 16:57:24 +0200 Subject: [PATCH] Fix types in summaly connector --- packages/backend/src/server/web/url-preview.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/server/web/url-preview.ts b/packages/backend/src/server/web/url-preview.ts index b28e813c6..ba3c8e1b4 100644 --- a/packages/backend/src/server/web/url-preview.ts +++ b/packages/backend/src/server/web/url-preview.ts @@ -31,7 +31,7 @@ export const urlPreviewHandler = async (ctx: Koa.Context): Promise => { const summary = meta.summalyProxy ? await getJson(`${meta.summalyProxy}?${query({ url, lang: lang ?? 'ja-JP', - })}`) : await summaly.default(url, { + })}`) as Awaited> : await summaly.default(url, { followRedirects: false, lang: lang ?? 'ja-JP', }); @@ -53,8 +53,8 @@ export const urlPreviewHandler = async (ctx: Koa.Context): Promise => { } }; -function wrap(url?: string): string | null { - return url != null +function wrap(url: string|null): string|null { + return url !== null ? url.match(/^https?:\/\//) ? `${config.url}/proxy/preview.webp?${query({ url,