summaryrefslogtreecommitdiff
path: root/src/server/web/url-preview.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/web/url-preview.ts')
-rw-r--r--src/server/web/url-preview.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/server/web/url-preview.ts b/src/server/web/url-preview.ts
index d5464d0cd4..cd53837a25 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.startsWith('data:')
+ ? url
+ : `https://images.weserv.nl/?url=${encodeURIComponent(url.replace(/^http:\/\//, ''))}`
: null;
}