- Notifications
You must be signed in to change notification settings - Fork928
fix: Resolve symlinks being written with size 0 in tar#1488
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.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -25,7 +25,14 @@ func Tar(directory string, limit int64) ([]byte, error) { | ||
if err != nil { | ||
return err | ||
} | ||
var link string | ||
if fileInfo.Mode()&os.ModeSymlink == os.ModeSymlink { | ||
link, err = os.Readlink(file) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
header, err := tar.FileInfoHeader(fileInfo, link) | ||
Comment on lines +28 to +35 Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. This is a bit confusing. It seems like this only works for symlinks, since we're no longer using the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. The second arg is actually only a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. So it should be empty if the file isn't a symlink? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I believe so | ||
if err != nil { | ||
return err | ||
} | ||
@@ -45,7 +52,7 @@ func Tar(directory string, limit int64) ([]byte, error) { | ||
if err := tarWriter.WriteHeader(header); err != nil { | ||
return err | ||
} | ||
if!fileInfo.Mode().IsRegular() { | ||
return nil | ||
} | ||
data, err := os.Open(file) | ||