datalad / datalad-next

DataLad extension for new functionality and improved user experience
https://datalad.org
Other
9 stars 10 forks source link

Test `uncurl` support for temporary token/access URLs #334

Open mih opened 1 year ago

mih commented 1 year ago

Example nextcloud-like temporary share URLs:

https://fz-juelich.sciebo.de/s/JUjJbWgFDturcHc/download?path=/cars&files=4horsemen.jpg

This points to a file 4horsemen.jpg in a folder /cars in a folder share. Those shares are very useful. They need no user management, can be password-protected, and expire after a customizable duration.

If a dataset has been exported to such a nextcloud instance (e.g. webdav filetree push), and shared in that way, we can add file availability info to each file using URLs like the one above, and have them be handled by uncurl. To make this complete, we need to define a match-expression for that URL like

(?P<site>https://[^/]+)/s/(?P<accesscode>[^/]+)/download\?path=/(?P<dir>[^&]+)&files=(?P<file>.*)$

If https://github.com/datalad/datalad-next/issues/157 is resolved, an alternative accesscode could be supplied via the configuration at runtime, and (re-)enable a download via a future temporary share, which is structurally identical, except for a different accesscode.

mslw commented 1 year ago

They need no user management, can be password-protected, and expire after a customizable duration.

If the share is password protected, the download link given above will redirect to a html login page. I don't know if and how a password could be given at this stage to get straight to content.

However, this post on the Nextcloud community forum shows that the file can be accessed through WebDAV, with shareID (accesscode) as username, and an equally transparent path:

curl -u "shareID:passWD" -H "X-Requested-With: XMLHttpRequest" "https://some.share.com/public.php/webdav/specific_filename.zip" -o specific_filename.zip