ckanext-googleanalytics
ckanext-googleanalytics copied to clipboard
Extension does not respect custom uploader implementations
ckanext--s3filestore implements a custom uploader and downloader, overriding the core download endpoint. ckanext-googleanalytics does the same, to register the download and calls the core download action from the package controller afterwards.
So if you load the googleanalytics
before the s3filestore
one, your downloads return 404, because the core filesystem filestore is being called:
ckan.plugins = ... googleanalytics s3filestore # Does not work
Loading googleanalytics
last works:
ckan.plugins = ... s3filestore googleanalytics # Works
cc @brew in case you ever bump into this
So what I did here is basically getting route's controller and overriding it's method by wrapping it into decorator. Previous behavior was - just to run default resource_download from PackageController in all of our cases. So by reordering our extensions (custom uploader or GA) in the .ini file one of them will not work.
#28 merged into master.
Is there any more recent activity on this? Not sure if its something on my end or not, but downloads to s3filestore are not working properly on my instance with CKAN 2.9.5 and s3filestore and googleanalytics extensions. I've tried flipping the order of the plugins and the downloads return an error both times. Uninstalling ckanext-googleanalytics resolves the issue.
I think, there was a config option, which should handle the problem. so, you have to:
- Put
googleanalytics
befores3filestore
in the plugins list. i.e:ckan.plugins = ... googleanalytics s3filestore ...
- Add a new config option which tells ga-plugin, which "custom" implementation to use:
googleanalytics.download_handler = ckanext.s3filestore.views:resource_download