Merge pull request #57 from stephen679/tar_symlink_size
keywords: return non-zero symlink size
This commit is contained in:
commit
ea6c6eff1b
1 changed files with 5 additions and 0 deletions
|
@ -255,6 +255,11 @@ var (
|
||||||
return fmt.Sprintf("mode=%#o", permissions), nil
|
return fmt.Sprintf("mode=%#o", permissions), nil
|
||||||
}
|
}
|
||||||
sizeKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (string, error) {
|
sizeKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (string, error) {
|
||||||
|
if sys, ok := info.Sys().(*tar.Header); ok {
|
||||||
|
if sys.Typeflag == tar.TypeSymlink {
|
||||||
|
return fmt.Sprintf("size=%d", len(sys.Linkname)), nil
|
||||||
|
}
|
||||||
|
}
|
||||||
return fmt.Sprintf("size=%d", info.Size()), nil
|
return fmt.Sprintf("size=%d", info.Size()), nil
|
||||||
}
|
}
|
||||||
cksumKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (string, error) {
|
cksumKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (string, error) {
|
||||||
|
|
Loading…
Reference in a new issue