Skip to content
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

Let browser handle downloads directly and support multi-file download #294

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ZNikke
Copy link
Contributor

@ZNikke ZNikke commented May 12, 2023

Currently dCacheView handles downloads by first doing the download and only when the download has completed it passes the object along for the browser to handle. The result is no feedback at all for users when initiating download of large files since the save dialog is shown on completion, and huge files might not download at all if the temporary browser download location runs out of space. Further frustrating users, you can select multiple files but is not allowed to select download.

Work around this by letting the browser handle the download instead, the method chosen is to create a temporary Anchor element to drive the download action as it has an explicit download attribute and avoids issues with modern browser pop-up blockers. Since username/password (Basic) auth can't be reliably passed along a short-lived Macaroon is created to handle the download. Existing Macaroons are used as-is to handle download in the shared-files view. Sessions with certificate authentication are assumed to work as-is, bypassing the Macaroon generation stage. The same basic mechanism is used to allow download of multiple files, this is also found to be easier to use on tablets/smartphones compared to the common .zip archive solution.

The result is a decent end user experience when downloading files, including multiple huge files that are common in a scientific data store.

Credits go to various threads on https://stackoverflow.com/ for explaining numerous corner cases and nuances in this area.

Fixes: #269
Fixes: #268

@ZNikke
Copy link
Contributor Author

ZNikke commented May 15, 2023

Ugh, discovered that I confused myself when testing to think that it worked in the shared-files view. It doesn't, in the sense that the shared-files view uses another code path with similar functionality as the main one and thus still has the old behavior.

I'll look into making this code be used there as well, to match the pull request description.

@ZNikke ZNikke force-pushed the let-browser-download branch from 757a1fb to bb332f3 Compare May 16, 2023 11:55
@ZNikke ZNikke changed the title Let browser handle downloads directly Let browser handle downloads directly and support multi-file download May 16, 2023
@ZNikke
Copy link
Contributor Author

ZNikke commented May 16, 2023

There, I think this works as intended now.

Currently dCacheView handles downloads by first doing the download and
only when the download has completed it passes the object along for the
browser to handle. The result is no feedback at all for users when
initiating download of large files since the save dialog is shown on
completion, and huge files might not download at all if the temporary
browser download location runs out of space.

Work around this by letting the browser handle the download instead, the
method chosen is to create a temporary Anchor element to drive the
download action as it has an explicit download attribute and avoids
issues with modern browser pop-up blockers. Since username/password
(Basic) auth can't be reliably passed along a short-lived Macaroon is
created to handle the download. Existing Macaroons are used as-is to
handle download in the shared-files top-level view. Sessions with
certificate authentication are assumed to work as-is, bypassing the
Macaroon generation stage.

The result is a decent end user experience when downloading files,
including huge files that are common in a scientific data store. Missing
in this patch is handling of subdirectories in the shared-files view.

Credits go to various threads on https://stackoverflow.com/ for
explaining numerous corner cases and nuances in this area.

Fixes: dCache#269

Signed-off-by: Niklas Edmundsson <[email protected]>
dCacheView is limited to file-by-file downloads, which is frustrating
users since there is support for multi-file selection.

This patch builds on the previous one to enable downloads for multi-file
selections. The simplest solution is implemented that triggers multiple
file downloads in the browser, this is also found to work best with
tablets and smartphones, where the traditional method by handling
multi-file download by providing a .zip archive of the files is really
cumbersome to handle.

There is also a completion of the implementation to handle
sub-directories in the shared-files view.

The end result is that it is now possible to select multiple files in a
directory and then download them in a smooth manner.

Fixes: dCache#268

Signed-off-by: Niklas Edmundsson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feedback to user on download Feature Request: Allow multiple files download
1 participant