From 62d17c9266baaa1a69d752c62581c0882226d8a9 Mon Sep 17 00:00:00 2001
From: MeiMei <30769358+mei23@users.noreply.github.com>
Date: Sun, 10 Feb 2019 19:19:26 +0900
Subject: [PATCH] Optimize url-preview image (#4216)

---
 src/server/web/url-preview.ts | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/server/web/url-preview.ts b/src/server/web/url-preview.ts
index 4cda5ecb01..dad27d9a9a 100644
--- a/src/server/web/url-preview.ts
+++ b/src/server/web/url-preview.ts
@@ -33,8 +33,8 @@ module.exports = async (ctx: Koa.BaseContext) => {
 
 function wrap(url: string): string {
 	return url != null
-		? url.startsWith('https://') || url.startsWith('data:')
-			? url
-			: `https://images.weserv.nl/?url=${encodeURIComponent(url.replace(/^http:\/\//, ''))}`
+		? url.match(/^https?:\/\//)
+			? `https://images.weserv.nl/?url=${encodeURIComponent(url.replace(/^http:\/\//, '').replace(/^https:\/\//, 'ssl:'))}&w=200&h=200`
+			: url
 		: null;
 }