Skip to content

Bug: Not all image URLs are supported #253

@Anush008

Description

@Anush008

The web UI looks for image URLs ending with jpg|jpeg|png|webp|gif|svg before displaying them on the dashboard.

So it won't work for ones like
https://cdn.discordapp.com/attachments/927784326899331092/1301524272585379932/og.png?ex=6724ca6f&is=672378ef&hm=6584c97a3a83eb4e23505bfdb0b88739c36b494deb9501c60ae9d9bcb652601e&

I think we should check if the value is a URL and image content type is returned in its HEAD response.

Related file:

function isImgUrl(string) {
let url;
try {
url = new URL(string);
} catch (_) {
return false;
}
if (url) {
return /\.(jpg|jpeg|png|webp|gif|svg)$/.test(url.pathname);
}
return false;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions