chore: use strings.ReplaceAll (#3801)

This commit is contained in:
Zhizhen He authored and GitHub committed 2024-05-18 17:06:33 +09:00
1 parent 0994d9c881
commit 01e7668915
6 files changed
+13 -13

No files matched your search

+3 -3
View File
@@ -157,10 +157,10 @@ func (x *Executor) QuoteEntry(entry string) string {
*/
return escapeArg(entry)
case shellTypePowerShell:
escaped := strings.Replace(entry, `"`, `\"`, -1)
return "'" + strings.Replace(escaped, "'", "''", -1) + "'"
escaped := strings.ReplaceAll(entry, `"`, `\"`)
return "'" + strings.ReplaceAll(escaped, "'", "''") + "'"
default:
return "'" + strings.Replace(entry, "'", "'\\''", -1) + "'"
return "'" + strings.ReplaceAll(entry, "'", "'\\''") + "'"
}
}