-
-
Notifications
You must be signed in to change notification settings - Fork 107
Add support for downloading a directory as a compressed tarball #544
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
Conversation
Changed Files
|
|
This is an early draft of the feature, implementing a prototype for #67. Disclaimer: I do not have much experience in async Rust (or even that much experience in Rust in general), my implementation might be subpar/unidiomatic. All kind of feedback is very much appreciated. |
|
Sorry for the delay, here are a few comments on the feature. I will add more if needed during the next days. But let me know what your thoughts are on this. --
Agree, let's go with a query param for the directory download.
What do you mean exactly by "conflicting combination"? For example, I think this feature will be behind an option flag like
I believe we can just say "download tarball" or "download tar.gz" whatever fits better. Something like: |
Hey, please take your time, don't worry about it! Thanks for the review too!
Yeap sure,
IMO in some cases,
Yeap sure, sounds great! |
Good question, I was thinking of only supporting in the future The text link can also be
I got it. In that case, let's make it dependent on $ static-web-server -p 1234 -d ./public \
--directory-listing --directory-listing-download=tar.gzThe |
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.
That's for now, I believe you are still refactoring the code and adding the SWS feature option. SWS options can be added via src/settings/cli.rs and src/settings/file.rs.
So I will wait for your changes first.
Just let me know if you have questions.
|
I think it's almost ready for review, just a few questions/confirmations:
|
Yes, since
What if we represent the I will investigate from my side as well. It would be much better to support an enum, but if not possible, we could use a simple
This sounds fine to me. If we do not panic the server thread, we are fine. |
Do we absolutely need to allow explicitly disabling using |
append `download-archive=<anything>` to query params of a directory will trigger tarball compression
instead of adding it as a file entry, make it part of the dir index page since the link is always constant anyway
- make dld a feature flag - handle conditional compilation - fix clippy errors
Technically it should be safe to unwrap as the filename will not contain invisible ASCII characters... Unless... the filename is non-ascii. Which needs to be encoded differently as 172 (0x007F) is illegal. TODO: handle unicode
still can't get `--download-list-format=` to work though
remove unrelated formatting change
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 did a quick review and encountered a few minor changes. I will continue reviewing and testing in a second round.
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.
There are a few last minor suggestions. It looks fine to me overall.
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.
Looks fine to me. Ready to be available in the upcoming release.
Thanks!

Description
Support downloading a directory as a compressed tarball.
download-archiveparameter set.<directory>, add a link with href?download-archive=1for user to download all content in directory as compressed tarball (see screenshot).Discussion & other notes
Is the "virtual file" approach appropriate? What should the server do when there is an existing.tar.gzfile?A radical alternative is to introduce an/api/group, which may also be used by other non-static-file features such as health endpointQuery param seems to be a more versatile and robust solution, e.g./<directory>/?download-archive=gzipfollow_symlinks()option for tar builder accordinglyTODO: content disposition unicode handlingApparently, non-ASCII is allowed by standard, and coincidentally there is a bug that does not validate the string the way it is documented, so everything works! see: HeaderValue::from_str does not validate that the string is valid ascii hyperium/http#519Related Issue
implement #67
Motivation and Context
This feature allows user to download the content of the entire directory all at once.
How Has This Been Tested?
download_targz,download_targz_no_symlinkstestcase to check downloaded tarball content against directory contentScreenshots (if appropriate):
(Final implementation)

(Previous POC)

Interface of this feature on other system
Github

A button in dropdown menu.
Jenkins

A link below list of files, separated from the list itself