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 processing_utils.save_url_to_cache() to follow redirects when accessing the URL #7322

Merged
merged 9 commits into from Feb 6, 2024

Conversation

whitphx
Copy link
Member

@whitphx whitphx commented Feb 6, 2024

Description

Closes: #7247

When testing this PR, remove your local Gradio cache first.

httpx methods don't follow URL redirects by default.
Refs:

In this PR, only processing_utils.save_url_to_cache() is modified to address #7247 , but do you think if there are some other places where the same fix should be applied?

@gradio-pr-bot
Copy link
Contributor

gradio-pr-bot commented Feb 6, 2024

🪼 branch checks and previews

Name Status URL
Spaces building...
Website ready! Website preview
🦄 Changes detected! Details

@gradio-pr-bot
Copy link
Contributor

gradio-pr-bot commented Feb 6, 2024

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
gradio patch
gradio_client patch
  • Maintainers can select this checkbox to manually select packages to update.

With the following changelog entry.

Fix processing_utils.save_url_to_cache() to follow redirects when accessing the URL

Maintainers or the PR author can modify the PR title to modify this entry.

Something isn't right?

  • Maintainers can change the version label to modify the version bump.
  • If the bot has failed to detect any changes, or if this pull request needs to update multiple packages to different versions or requires a more comprehensive changelog entry, maintainers can update the changelog file directly.

@whitphx whitphx marked this pull request as ready for review February 6, 2024 13:30
Copy link
Collaborator

@freddyaboulton freddyaboulton left a comment

Choose a reason for hiding this comment

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

I think the only other place where we need to make this change is validate_url in gradio/utils.py. Other than that, looks great! Thanks @whitphx !

Copy link
Member

@abidlabs abidlabs left a comment

Choose a reason for hiding this comment

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

LGTM @whitphx! Added follow_redirects to a few missing places and added a test. Will merge in to include in the release.

@abidlabs abidlabs enabled auto-merge (squash) February 6, 2024 19:45
@abidlabs abidlabs merged commit b25e95e into main Feb 6, 2024
6 of 7 checks passed
@abidlabs abidlabs deleted the url-cache-follow-redirects branch February 6, 2024 19:46
@pngwn pngwn mentioned this pull request Feb 6, 2024
freddyaboulton pushed a commit that referenced this pull request Feb 9, 2024
…ccessing the URL (#7322)

* Fix `processing_utils.save_url_to_cache()` to follow redirects when accessing the URL

* add changeset

* follow more redirects

* format

* add changeset

* add test

* validate urls

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
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.

gr.Image (and other file-based components) should follow URL redirects
4 participants