certat / do-portal

This project is in maintenance mode and will only receive bug fixes, but no new features. A new version of this software is being developed.
5 stars 5 forks source link

Eventdownload #73

Closed ghost closed 5 years ago

ghost commented 5 years ago

Procedure:

@MarkHofstetter Please provide the name of the directory the files should be

MarkHofstetter commented 5 years ago

app/static/data

(should be in .gitignore)

MarkHofstetter commented 5 years ago

added 79fd24f26b4c83039c9be2a538e6124b8726d0d3

curl -s -H "Content-Type: application/json" -H "Accept: application/json" -H "API-Authorization: " http://localhost:8000/cp/1.0/organizations//download_events

needs 2 new config params

DATA_DIR="data" # must be placed under app/static/ DATA_SUFFIX="json.zip"

so files must be named .json.zip eg 4711.json.zip

davewood commented 5 years ago

Without a Content-Disposition header from the backend I cannot easily control the filename of the download file because the attribute download="events.json.zip" will be ignored if the same-origin policy is violated.

davewood commented 5 years ago

we are currently using send_static_file() which is only supposed to be used internally and doesnt support setting headers. the better approach is probably to use send_file() we need to find out if FlaskApi supports it first.

http://flask.pocoo.org/docs/0.12/api/#flask.send_file

https://www.programcreek.com/python/example/58917/flask.send_file

ghost commented 5 years ago

It works.

The filename is still download_events.

ghost commented 5 years ago

Created #77 for minor issues/feature requests