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

Add a filter for return URL to edd_get_download_file_url() ? #4938

Closed
Shelob9 opened this Issue Sep 12, 2016 · 4 comments

Comments

Projects
None yet
3 participants
@Shelob9
Copy link
Collaborator

Shelob9 commented Sep 12, 2016

It would be really useful to me, if the return value of edd_get_download_file_url() had a filter. My use case is I want to serve files from our free add-ons from WordPress.org so I don't have to manually upload the files when those plugins are updated on WordPress.org. So it would be really helpful to be able to write a filter that checked download ID and changed the URL for some IDs to a link from WordPress.org.

My concern is this would allow add-ons to totally wipe out the secure tokenized URL. I assume that is why there is a edd_download_file_url_args filter, but not a edd_download_file_url filter. So I wanted to ask first if this would be an acceptable filter, before putting in the PR.

@mindctrl

This comment has been minimized.

Copy link
Member

mindctrl commented Sep 12, 2016

@Shelob9 you can also use this URL format to always grab the latest release from wporg:

https://downloads.wordpress.org/plugin/plugin-slug.latest-stable.zip

@Shelob9

This comment has been minimized.

Copy link
Collaborator

Shelob9 commented Sep 12, 2016

@mindctrl Thanks for that. I had tried to use https://downloads.wordpress.org/plugin/caldera-forms.zip but that was giving a version from a year ago, for no apparent reason. I'll switch to this format.

Still, I'm wondering if there is use for this filter...

@cklosowski

This comment has been minimized.

Copy link
Member

cklosowski commented Oct 5, 2017

I'm closing this out. Modifying the download URL here gives the ability to bypass tokenization and expiration. It would be best to use this filter for altering the URL where the file is delivered:

$requested_file = apply_filters( 'edd_requested_file', $requested_file, $download_files, $args['file_key'] );

@cklosowski cklosowski closed this Oct 5, 2017

@mindctrl

This comment has been minimized.

Copy link
Member

mindctrl commented Oct 5, 2017

@Shelob9 if you are/were using the Free Downloads extension, there's a known caching issue with remote files. We saw the same thing recently. easydigitaldownloads/edd-free-downloads#188

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment