-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
adding archive entry paths #3638
Open
joeleonjr
wants to merge
13
commits into
main
Choose a base branch
from
archive-entry-paths
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+68
−28
Open
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
8c4c83b
initial pass at adding archive entry paths
joeleonjr fc528d2
updated to combine archive paths + depth
joeleonjr 6cfae75
Merge branch 'main' into archive-entry-paths
joeleonjr 05fcfe6
Merge branch 'main' into archive-entry-paths
joeleonjr 6c1feea
updated decompressor file naming
joeleonjr 6ec0688
Merge branch 'main' into archive-entry-paths
joeleonjr 704937a
updated test cases
joeleonjr 48d9323
Merge branch 'main' into archive-entry-paths
joeleonjr 8ab76fa
Merge branch 'main' into archive-entry-paths
joeleonjr 4283b1d
Merge branch 'main' into archive-entry-paths
joeleonjr ceefd1e
Merge branch 'main' into archive-entry-paths
joeleonjr 36bdef0
swapped file.Name() for file.NameInArchive
joeleonjr a37a6dd
Merge branch 'archive-entry-paths' of https://github.com/trufflesecur…
joeleonjr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
updated decompressor file naming
commit 6c1feea1ef5e7f5dab8f49f0fbe0b80c518fff37
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
If we ever end up stringifying the slice of path parts, an empty string isn't going to maximally visually obvious as another level of depth, compared to like a
?
or something. (Compare:some/path///file.txt
to e.g.some/path/?/?/file.txt
) What do you think of using a non-empty marker like?
instead?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.
Commit 36bdef0 fixes an oversight from an earlier version and is relevant to this discussion.
The main change is using
file.NameInArchive
instead offile.Name()
. The difference isfile.NameInArchive
contains the relative path inside the archive that is being extracted. This does a few things:file.Name()
operation just grabbed the filename, not the path. That's fixed and we now have complete relative file paths in all supported archives.archive.tar.gz
with a file namedsecret.txt
, it would return this in the archive entry patharchive.tar.gz/archive/secret.txt
. When you manually double-click to unarchivearchive.tar.gz
it tosses all of the contents into a new folder namedarchive
and then you'd seesecret.txt
. It's super clean and clear. This method still uses the""
to track depth during decompression, but in thefilepath.Join()
operation, empty strings are ignored, which is exactly what we want to reconstruct the relative file path. If we change to add?
or anything else, we'd need to write a custom function to strip those out during thefilepath.Join()
. Since we're able to keep accurate track ofdepth
and relative file path, I'd suggest just leaving as is.file.NameInArchive
b/c I didn't want to bloat our non-error logs with the entire file path. This means the log at the very beginning of theextractorHandler
function only hasfile.Name()
. Not sure if that was the correct call or not.