-
Notifications
You must be signed in to change notification settings - Fork 446
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
feat: make the builtin extract
plugin support compressed tarballs (*.tar.gz
, *.tar.bz2
, etc.)
#1583
Conversation
BTW, Do I need to combine the other commits or I can have separate commit in the same PR? |
There are more suffixes than ".tar", ".tgz", ".tar.gz", ".tar.bz2". And short forms should be supported as well. |
You can make multiple commits in this PR, and I'll squash and merge them into one. |
Thanks! Definitely will go test and add this! |
Is this going to fix the preview issues with tar files as well? |
What issue specifically? If you're talking about preview does not show the final file of the |
That's what I was referring to. And I hoped that this would have killed two birds with one stone. But that's okay because I think it will be easy to fix after this PR. |
72571df
to
9483798
Compare
* Add spawn_tar function and tar_compatible function - Create spawn_tar function to run command with tar -xvf to unzip file to tmp file * Add os.excute() line to make sure the tmp dir exists because tar command will not automatically create that dir * Refactor the logic in the try function to if the zip file can be unzipped with tar and no password required, use tar, otherwise use 7z
* Create a new method "create" in fs.rs * Delete archive:is_encrypted in tar use * Convert the tar command from -xvf to -xaf * Add more File suffix that can be unzipped with tar
I finally had time to test it today (sorry for the delay), I found that we can directly reuse 7zip to extract tar files, which eliminates the need for an additional dependency. Plus, 7zip is more cross-platform friendly (some older Windows systems can also use it) |
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.
Thanks!
extract
plugin support compressed tarballs (*.tar.gz
, *.tar.bz2
, etc.)
Awesome! Thank you both. |
Closes #1548.
Description:
spawn_tar
function andis_tar_compatible
functionspawn_tar
function to run command withtar -xaf
to unzip file to tmp directoryis_tar_compatible
function to tell if a zip file can be extracted withtar
commandos.excute()
line to make sure the tmp dir exists becausetar
command will not automatically create that dir, unlike7z
try()
function to if the zip file can be unzipped with tar and no password required, usetar
, otherwise use7z
instead