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.
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
base: main
Are you sure you want to change the base?
adding archive entry paths #3638
Changes from all commits
8c4c83b
fc528d2
6cfae75
05fcfe6
6c1feea
6ec0688
704937a
48d9323
8ab76fa
4283b1d
ceefd1e
36bdef0
a37a6dd
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
imo just attach the paths here now that you have them
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.
Do you mean change
depth
topaths
in the logs?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.