ImageZoom: Fix magnifier showing a broken image for some plugins (#4507)

This commit is contained in:
reservedbytes 2026-08-27 06:36:58 +00:00 • committed by GitHub
parent 0723d49f5c
commit ef80de6773
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -153,6 +153,10 @@ export const Magnifier = ErrorBoundary.wrap<MagnifierProps>(({ instance, size: i
const imageSrc = useMemo(() => {
try {
const imageUrl = new URL(instance.props.src);
if (imageUrl.protocol !== "http:" && imageUrl.protocol !== "https:")
return instance.props.src;
if (imageUrl.pathname.startsWith("/attachments/"))
imageUrl.hostname = "cdn.discordapp.com";