Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork98
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
semanticdiff-combot commentedMay 21, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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. |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
joseluisq commentedMay 24, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.gz The |
joseluisq left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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 viasrc/settings/cli.rs
andsrc/settings/file.rs
.
So I will wait for your changes first.
Just let me know if you have questions.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
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. |
ekangmonyet commentedMay 27, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Do we absolutely need to allow explicitly disabling using |
append `download-archive=<anything>` to query params of a directory willtrigger tarball compression
instead of adding it as a file entry, make it part of the dir index pagesince 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 containinvisible ASCII characters...Unless... the filename is non-ascii. Which needs to be encodeddifferently 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.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
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.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
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!
89f5846
intostatic-web-server:masterUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Description
Support downloading a directory as a compressed tarball.
download-archive
parameter set.<directory>
, add a link with href?download-archive=1
for 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.gz
file?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=gzip
follow_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_symlinks
testcase 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