mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(host): quote include paths when before executing tar (#23969)
This commit is contained in:
@@ -2866,6 +2866,8 @@ func (s *sPodGuestInstance) tarHostDir(srcDir, targetPath string,
|
||||
for i := range files {
|
||||
if fileutils2.Exists(filepath.Join(srcDir, files[i])) {
|
||||
result = append(result, files[i])
|
||||
} else {
|
||||
log.Warningf("tar path doesn't exist: %q", filepath.Join(srcDir, files[i]))
|
||||
}
|
||||
}
|
||||
return result
|
||||
@@ -2879,6 +2881,9 @@ func (s *sPodGuestInstance) tarHostDir(srcDir, targetPath string,
|
||||
}
|
||||
includeStr := "."
|
||||
if len(includeFiles) > 0 {
|
||||
for i := range includeFiles {
|
||||
includeFiles[i] = fmt.Sprintf("'%s'", includeFiles[i])
|
||||
}
|
||||
includeStr = strings.Join(includeFiles, " ")
|
||||
}
|
||||
cmd := fmt.Sprintf("%s --ignore-failed-read -cf %s -C %s %s", baseCmd, targetPath, srcDir, includeStr)
|
||||
|
||||
Reference in New Issue
Block a user