Files
dredgegram/resources/js/lib/proxyImage.ts
T
dredgy b2f2d8b104
linter / quality (push) Canceled after 0s
tests / ci (8.3) (push) Canceled after 0s
tests / ci (8.4) (push) Canceled after 0s
tests / ci (8.5) (push) Canceled after 0s
Initial Commit
2026-08-29 00:17:41 +10:00

9 lines
436 B
TypeScript

export function proxyImage(url: string | null | undefined): string | undefined {
if (!url) return undefined;
// Already a local path (e.g. cached media) — load it directly. The proxy
// only knows how to handle Instagram's own CDN hosts, and a relative
// path has no host at all, so it would otherwise get rejected.
if (url.startsWith('/')) return url;
return `/image-proxy?url=${encodeURIComponent(url)}`;
}