Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(view-data): Add image content type check for URLs in view data page #255

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kartik-gupta-ij
Copy link
Member

@kartik-gupta-ij kartik-gupta-ij commented Nov 1, 2024

fixes : #253

  • Added fallback logic: if no extension is found, the UI checks if the URL is valid and attempts a HEAD request to confirm the content type is an image. Note: this approach may encounter CORS restrictions on some domains.
  • Thank you @Anush008 for identifying this issue with non-standard URLs!

Copy link
Member

@Anush008 Anush008 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kartik-gupta-ij.
Super fast turnaround.

useEffect(() => {
const fetchImageUrls = async () => {
const urls = [];
for (const key in data) {
Copy link
Member

@Anush008 Anush008 Nov 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a thought.
Maybe a Promise.all to check them all at once?

@generall
Copy link
Member

generall commented Nov 1, 2024

Is that correct that with this change web-ui will send requests to all URLs on preview?

@Anush008
Copy link
Member

Anush008 commented Nov 1, 2024

Is that correct that with this change web-ui will send requests to all URLs on preview?

Yes.

For the 10 points that are displayed, if the value is a URL and doesn't have an image extension in it, A HEAD request is made.

@generall
Copy link
Member

generall commented Nov 1, 2024

It is arguable, that this is actually desired behavior. What's the use-case?

@Anush008
Copy link
Member

Anush008 commented Nov 2, 2024

What's the use-case?

Only one actually. To support image URLs like https://www.bothellwa.gov/ImageRepository/Document?documentID=8024.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Not all image URLs are supported
3 participants