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

Query arguments need to be escaped #66

Open
gdbarron opened this issue Nov 17, 2022 · 0 comments · May be fixed by #72
Open

Query arguments need to be escaped #66

gdbarron opened this issue Nov 17, 2022 · 0 comments · May be fixed by #72

Comments

@gdbarron
Copy link

I am attempting to delete a file and this is failing due to the slash in the file location.

d := map[string]string{
	"filelocation": "nsconfig/ssl",
}
err = adc.DeleteResourceWithArgsMap(service.Systemfile.Type(), myfilename, d)

This returns a 400,

GET /nitro/v1/config/systemfile/myfilename?args=filelocation:nsconfig/ssl HTTP/1.1" 400 111 "-" "Go-http-client/1.1

As it doesn't find the item it doesn't try to delete.

The fix was to escape the string and ensure / is changed to %2F.

d := map[string]string{
	"filelocation": url.PathEscape("nsconfig/ssl"),
}
err = adc.DeleteResourceWithArgsMap(service.Systemfile.Type(), myfilename, d)
GET /nitro/v1/config/systemfile/myfilename?args=filelocation:nsconfig%2Fssl HTTP/1.1" 200 221 "-" "Go-http-client/1.1
DELETE /nitro/v1/config/systemfile/myfilename?args=filelocation:nsconfig%2Fssl HTTP/1.1" 200 57 "-" "Go-http-client/1.1"

I'm assuming this will be the same issue for all query parameters and not specific to my use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant