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

Allow HTTP redirects for file downloads #458

Merged
merged 3 commits into from
Jun 26, 2024
Merged

Conversation

alexdewar
Copy link
Contributor

@alexdewar alexdewar commented Jun 24, 2024

It turns out GitHub often redirects file downloads to another URL, which the current code won't handle. Fix by telling libcurl to allow this (it's disabled by default).

Fixes #457.

With this fix, we can finally use data from the healthgps-data repo as an input source directly 😄

See: https://github.com/imperialCHEPI/healthgps-data/releases/tag/20240624

@alexdewar
Copy link
Contributor Author

PS -- I noticed download_file() was pointlessly returning an input argument, so I removed it.

Copy link
Contributor

@jamesturner246 jamesturner246 left a comment

Choose a reason for hiding this comment

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

LGTM 👍

It turns out GitHub often redirects file downloads to another URL, which the current code won't handle. Fix by setting telling libcurl to allow this (it's disabled by default).

Fixes #457.
hgps::data::download_file() takes a download path and also returns that same path, which is pointless. Change return type to void.
@alexdewar alexdewar force-pushed the allow_http_redirects branch from d47a81b to 22a63e9 Compare June 26, 2024 11:48
@alexdewar alexdewar enabled auto-merge June 26, 2024 11:48
@alexdewar alexdewar merged commit c230f08 into main Jun 26, 2024
5 checks passed
@alexdewar alexdewar deleted the allow_http_redirects branch August 27, 2024 10:31
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.

Passing URL of data source from GitHub doesn't work
2 participants