fix: Do not fail on nil error

Commit 92ddcdae09 has introduced a
regression due to which copyDir() would fail after closing the archive
successfully

Signed-off-by: Vitaliy Potyarkin <v.potyarkin@yadro.com>
This commit is contained in:
Vitaliy Potyarkin 2024-12-27 17:56:23 +03:00
parent 050bc604f8
commit 1dc0d695a1

View file

@ -753,7 +753,7 @@ func (cr *containerReference) copyDir(dstPath string, srcPath string, useGitIgno
defer func(tarFile *os.File) {
name := tarFile.Name()
err := tarFile.Close()
if !errors.Is(err, os.ErrClosed) {
if err != nil && !errors.Is(err, os.ErrClosed) {
logger.Error(err)
}
err = os.Remove(name)