Fix calculation of relative path for symlink on docker save
Relative paths are now calculated from a base path rather than from the file path, which gets treated like a directory.
Symlinks will now properly point to the file as "../<layer dir>/layer.tar" rather the incorrect "../../<layer dir>/layer.tar".
Fixes #24951
Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
(cherry picked from commit 5487881e12
)
Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
parent
25cf7999fa
commit
e111f0c7b2
1 changed files with 1 additions and 1 deletions
|
@ -307,7 +307,7 @@ func (s *saveSession) saveLayer(id layer.ChainID, legacyImg image.V1Image, creat
|
|||
defer layer.ReleaseAndLog(s.ls, l)
|
||||
|
||||
if oldPath, exists := s.diffIDPaths[l.DiffID()]; exists {
|
||||
relPath, err := filepath.Rel(layerPath, oldPath)
|
||||
relPath, err := filepath.Rel(outDir, oldPath)
|
||||
if err != nil {
|
||||
return distribution.Descriptor{}, err
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue