-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Incorrect processing of redirects using download_url() #3235
Comments
@slipnitskaya Thanks for reporting. I don't think simply allowing redirects will do it because the website now hosts the dataset on google drive. @pmeier Thoughts? |
I never had to deal with redirects so take what I say with a grain of salt. @slipnitskaya I agree, handling redirects is a good addition and I will review your PR later on. That being said I think @datumbox is right that redirecting won't help you with your problem since In order achieve what you want, we could include a simple regular expression in the beginning of |
Thanks for reviewing! @pmeier Would be great indeed to add support for dispatching of download requests to Google Drive inside |
Sounds good @slipnitskaya! I think we should split this into two separate PRs. You can simply ping me when it is ready for review. |
* Make download_url() follow redirects Fix bug related to the incorrect processing of redirects. Follow the redirect chain until the destination is reached or the number of redirects exceeds the max allowed value (by default 10). * Parametrize value of max allowed redirect number Make max number of hops a function argument and assign its default value to 10 * Propagate the max number of hops to download_url() Add the maximum number of redirect hops parameter to download_url() * check file existence before redirect * remove print * remove recursion * add tests * Reducing max_redirect_hops Co-authored-by: Vasilis Vryniotis <[email protected]> Co-authored-by: Philip Meier <[email protected]> Co-authored-by: Vasilis Vryniotis <[email protected]>
Closed in #3236. |
Summary: * Make download_url() follow redirects Fix bug related to the incorrect processing of redirects. Follow the redirect chain until the destination is reached or the number of redirects exceeds the max allowed value (by default 10). * Parametrize value of max allowed redirect number Make max number of hops a function argument and assign its default value to 10 * Propagate the max number of hops to download_url() Add the maximum number of redirect hops parameter to download_url() * check file existence before redirect * remove print * remove recursion * add tests * Reducing max_redirect_hops Reviewed By: datumbox Differential Revision: D25954556 fbshipit-source-id: 3b2c64592d5882b98e87acdb5efd95e9283d2862 Co-authored-by: Vasilis Vryniotis <[email protected]> Co-authored-by: Philip Meier <[email protected]> Co-authored-by: Vasilis Vryniotis <[email protected]>
🐛 Bug
torchvision.datasets.utils.download_url() processes redirects incorrectly.
An attempt to download via URL that returns redirect headers fails and results in an empty file.
To Reproduce
The behavior can be reproduced using link to the CUB-200-2011 dataset. Here's the example execution:
Expected behavior
The file is expected to be downloaded correctly given URL.
Environment
cc @pmeier
The text was updated successfully, but these errors were encountered: