From 21f894e8cf6f06fd4cf2e85cae0728e5237345e0 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 6 May 2018 02:08:27 +0900 Subject: [PATCH] Fix bugs --- src/server/web/url-preview.ts | 4 +++- src/server/web/views/note.pug | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/server/web/url-preview.ts b/src/server/web/url-preview.ts index d5464d0cd..8a5e934b1 100644 --- a/src/server/web/url-preview.ts +++ b/src/server/web/url-preview.ts @@ -14,6 +14,8 @@ module.exports = async (ctx: Koa.Context) => { function wrap(url: string): string { return url != null - ? `https://images.weserv.nl/?url=${url.replace(/^https?:\/\//, '')}` + ? url.startsWith('https://') + ? url + : `https://images.weserv.nl/?url=${url.replace(/^http:\/\//, '')}` : null; } diff --git a/src/server/web/views/note.pug b/src/server/web/views/note.pug index bc8dcdab8..22f183405 100644 --- a/src/server/web/views/note.pug +++ b/src/server/web/views/note.pug @@ -4,7 +4,6 @@ block vars - const user = note.user; - const title = user.name ? `${user.name} (@${user.username})` : `@${user.username}`; - const url = `${config.url}/notes/${note.id}`; - - const img = user.avatarId ? `${config.drive_url}/${user.avatarId}` : null; block title = `${title} | Misskey` @@ -18,7 +17,7 @@ block meta meta(property='og:title' content= title) meta(property='og:description' content= summary) meta(property='og:url' content= url) - meta(property='og:image' content= img) + meta(property='og:image' content= user.avatarUrl) if note.prev link(rel='prev' href=`${config.url}/notes/${note.prev}`)