fix: improve support for folder names with spaces (#174)

- Add a test for a target folder with spaces in the name
- Fix a bug in the `buildUnTarArgs` function that caused it to fail when receiving a target with spaces
- Remove unused code in the `TestRemoveDestFile` function

ref https://github.com/appleboy/scp-action/issues/85
This commit is contained in:
Bo-Yi Wu
2023-04-11 12:54:53 +08:00
committed by GitHub
parent de5e936a05
commit 41313253fa
3 changed files with 62 additions and 12 deletions
+2 -2
View File
@@ -5,7 +5,7 @@ func rmcmd(os, target string) string {
case "windows":
return "DEL /F /S " + target
case "unix":
return "rm -rf " + target
return "rm -rf '" + target + "'"
}
return ""
}
@@ -15,7 +15,7 @@ func mkdircmd(os, target string) string {
case "windows":
return "if not exist " + target + " mkdir " + target
case "unix":
return "mkdir -p " + target
return "mkdir -p '" + target + "'"
}
return ""