inveniosoftware / invenio-files-rest

REST API for uploading/downloading files for Invenio.
https://invenio-files-rest.readthedocs.io
MIT License
9 stars 67 forks source link

Send signal with a sender for upload, delete and download actions #262

Closed sebdeleze closed 1 year ago

sebdeleze commented 3 years ago

When trying to subscribe to download hook, for instance in https://github.com/inveniosoftware/invenio-stats/blob/master/invenio_stats/receivers.py#L52, the event is not triggered, as the sender is not the app.

It would be better to pass the sender when the event is fired, as it was done before v1.0.5 (https://github.com/inveniosoftware/invenio-files-rest/commit/f309ca0e506c8aff8141abc6a715134353d4b66b#diff-438fa464815046f99b08cc785585af65dca7361613e8e9754ea9e743b10fb22eL660).

In addition, the signal for download event must be sent only if the query param download is set.

Of course, this has to be done for all hooks (download, upload, delete).