-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
init file download via POST #26155
init file download via POST #26155
Conversation
An alternative that would keep the browser's download progress would be to announce the download with a post-request, the returns a token, and then trigger the download again by GET but only providing the token as parameter. |
For me that is a huge issue. |
Somehow reminds me of pre-signed download URLs, which are a slightly different thing though. |
This is now implemented. On smoke testing it of course turned out that sharing needs extra care. There is duplication to some degree, so that's still to tackle. |
699d9e8
to
a1d007b
Compare
9878480
to
7c33107
Compare
* | ||
*/ | ||
|
||
import download from './services/Download' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would argue that the service file name is a bit too simple and confusing.
But it's no blocker:
Something like ?
import download from './services/Download' | |
import download from './services/DownloadFileService' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. Just, service is now duplicated (in the path), and what else do you download other than files? It's also actually executing a download. You could argue whether the business logic (register first, then execute), however I think that's an implementation detail here.
7c33107
to
ca81e95
Compare
- also turns old download php script to Controller - increases number of possible files for lifting length restrictions in GET data Signed-off-by: Arthur Schiwon <[email protected]>
- download relevant data is sent per POST, a token is received - download is started by GET and the received token - solves the disadvantages from XHR-only download - job to cleanup download tokens Signed-off-by: Arthur Schiwon <[email protected]>
unfinished and not and the table, closing. |
Currently file downloads are triggered by a regular GET request through changing the window location. This can leak file names, but also limits the number of downloadable files for URL length restrictions.
~~By switching to a POST request (thus through XHR) we can avoid both aspects. The downside with the chosen method is, that it does not stream the data: the UI is not blocked, but the browser's download progress does not kick in and the save dialog appears only after the file is downloaded. ~~
Switch to register the download action via POST call that provides all the information. A token is returned, which is then passed along by the GET request through location change. Save dialogue is shown immediately and the browser progress indicator works again, too.
As far as I researched there is no way around with XHR (no stream support by design). Streams API offer support, alas – as far as i know - still would suffer the same problems around the built-in progress bar and save dialog (and cannot be backported for lack of IE support).
Another approach would be to use the progress indicator as with file uploads with downloads, too. But maybe I also oversaw an option?Now: