mirror of
https://github.com/vbatts/go-mtree.git
synced 2024-11-22 16:25:38 +00:00
Not all files will have a symlink
The linkname field in the header might not always have a value. Need to check empty linkname. Signed-off-by: Stephen Chung <schung@redhat.com>
This commit is contained in:
parent
bacbea465f
commit
d906a5994a
1 changed files with 4 additions and 1 deletions
|
@ -206,7 +206,10 @@ var (
|
|||
}
|
||||
linkKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (string, error) {
|
||||
if sys, ok := info.Sys().(*tar.Header); ok {
|
||||
return fmt.Sprintf("link=%s", sys.Linkname), nil
|
||||
if sys.Linkname != "" {
|
||||
return fmt.Sprintf("link=%s", sys.Linkname), nil
|
||||
}
|
||||
return "", nil
|
||||
}
|
||||
|
||||
if info.Mode()&os.ModeSymlink != 0 {
|
||||
|
|
Loading…
Reference in a new issue