Skip to content

Commit baf5728

Browse files
committed
fix: handle protocol relative urls
1 parent 3dcea43 commit baf5728

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

server/utils/image-proxy.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ export function toProxiedImageUrl(url: string): string {
102102
return url
103103
}
104104

105+
// Protocol-relative URLs should be treated as HTTPS for proxying purposes
106+
if (url.startsWith('//')) {
107+
url = `https:${url}`
108+
}
109+
105110
const parsed = URL.parse(url)
106111
if (!parsed || (parsed.protocol !== 'http:' && parsed.protocol !== 'https:')) {
107112
return url

0 commit comments

Comments
 (0)