qdrant / qdrant-web-ui

Self-hosted web UI for Qdrant
Apache License 2.0
217 stars 85 forks source link

Bug: Not all image URLs are supported #253

Open Anush008 opened 1 day ago

Anush008 commented 1 day ago

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: https://github.com/qdrant/qdrant-web-ui/blob/296764642e8ebefcffb8b08d7d69246dafccf9e1/src/components/Points/PointImage.jsx#L10-L21

kartik-gupta-ij commented 8 hours ago

Hey @Anush008,

Thanks for pointing this out! Currently, the Web UI indeed looks for image URLs containing extensions like .jpg|jpeg|png|webp|gif|svg within the string, not just at the end. This means URLs like the one you shared should be rendered fine, as long as they include one of these extensions.

Screenshot 2024-11-01 at 5 08 29 PM

Regarding the idea of checking the content type via a HEAD request to confirm it's an image – that’s a solid approach, but it might run into CORS issues with some images. If the server blocks these requests, we won’t be able to access the headers directly. Let me know if you want to explore this further, or if you have any other ideas!

Anush008 commented 8 hours ago

Thanks for pointing this out! Currently, the Web UI indeed looks for image URLs containing extensions like .jpg|jpeg|png|webp|gif|svg within the string, not just at the end.

Right. Got it. That would still miss URLs like https://www.bothellwa.gov/ImageRepository/Document?documentID=8024

Regarding the idea of checking the content type via a HEAD request to confirm it's an image – that’s a solid approach, but it might run into CORS issues with some images. If the server blocks these requests,

We don't have to render such images if a server blocks them.