diff --git a/pkg/archive/copy.go b/pkg/archive/copy.go index 0614c67cec..5281e29d18 100644 --- a/pkg/archive/copy.go +++ b/pkg/archive/copy.go @@ -332,6 +332,9 @@ func RebaseArchiveEntries(srcContent io.Reader, oldBase, newBase string) io.Read } hdr.Name = strings.Replace(hdr.Name, oldBase, newBase, 1) + if hdr.Typeflag == tar.TypeLink { + hdr.Linkname = strings.Replace(hdr.Linkname, oldBase, newBase, 1) + } if err = rebasedTar.WriteHeader(hdr); err != nil { w.CloseWithError(err)