ImageZoom: Fix magnifier showing a broken image for some plugins (#4507)
This commit is contained in:
parent
0723d49f5c
commit
ef80de6773
1 changed files with 4 additions and 0 deletions
|
|
@ -153,6 +153,10 @@ export const Magnifier = ErrorBoundary.wrap<MagnifierProps>(({ instance, size: i
|
||||||
const imageSrc = useMemo(() => {
|
const imageSrc = useMemo(() => {
|
||||||
try {
|
try {
|
||||||
const imageUrl = new URL(instance.props.src);
|
const imageUrl = new URL(instance.props.src);
|
||||||
|
|
||||||
|
if (imageUrl.protocol !== "http:" && imageUrl.protocol !== "https:")
|
||||||
|
return instance.props.src;
|
||||||
|
|
||||||
if (imageUrl.pathname.startsWith("/attachments/"))
|
if (imageUrl.pathname.startsWith("/attachments/"))
|
||||||
imageUrl.hostname = "cdn.discordapp.com";
|
imageUrl.hostname = "cdn.discordapp.com";
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue