ckanext-googleanalytics icon indicating copy to clipboard operation
ckanext-googleanalytics copied to clipboard

Extension does not respect custom uploader implementations

Open amercader opened this issue 9 years ago • 5 comments

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

amercader avatar Dec 17 '15 11:12 amercader

cc @brew in case you ever bump into this

amercader avatar Dec 17 '15 11:12 amercader

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.

gleb-rudenko avatar Feb 17 '17 11:02 gleb-rudenko

#28 merged into master.

smotornyuk avatar Mar 27 '17 11:03 smotornyuk

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.

ctrepka avatar Jul 06 '22 19:07 ctrepka

I think, there was a config option, which should handle the problem. so, you have to:

  1. Put googleanalytics before s3filestore in the plugins list. i.e:
    ckan.plugins = ... googleanalytics s3filestore ...
    
  2. Add a new config option which tells ga-plugin, which "custom" implementation to use:
    googleanalytics.download_handler = ckanext.s3filestore.views:resource_download
    

smotornyuk avatar Jul 12 '22 08:07 smotornyuk