Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Quote in username errors dapr init #972 #1322

Merged
merged 9 commits into from
Jun 26, 2023
1 change: 1 addition & 0 deletions pkg/standalone/standalone.go
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,7 @@ func moveFileToPath(filepath string, installLocation string) (string, error) {
p := os.Getenv("PATH")

if !strings.Contains(strings.ToLower(p), strings.ToLower(destDir)) {
utils.SanitizeDir(&destDir)
pathCmd := "[System.Environment]::SetEnvironmentVariable('Path',[System.Environment]::GetEnvironmentVariable('Path','user') + '" + fmt.Sprintf(";%s", destDir) + "', 'user')"
_, err := utils.RunCmdAndWait("powershell", pathCmd)
if err != nil {
Expand Down
5 changes: 5 additions & 0 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,3 +403,8 @@
}
return filePath, nil
}

// SanitizeDir corrects any syntactical errors in the passed directory.
shubham1172 marked this conversation as resolved.
Show resolved Hide resolved
func SanitizeDir(destDir *string) {
mohitpalsingh marked this conversation as resolved.
Show resolved Hide resolved
*destDir = strings.Replace(*destDir, "'", "''", -1)

Check failure on line 409 in utils/utils.go

View workflow job for this annotation

GitHub Actions / Build linux_amd64 binaries

wrapperFunc: use strings.ReplaceAll method in `strings.Replace(*destDir, "'", "''", -1)` (gocritic)
}
Loading