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,