Open spacedub opened 2 years ago
Moving to v0.24.0, the changes are more than expected:
path.Join("/foo/bar", "testthis://foo")
, the final path after path.Join
will not have the extra /
and will be /foo/bar/testthis:/foo
/foo/bar/testthis://foo
, the router is not able to redirect that to /foo/bar/{name}
So it seems that we need to set the path to the escaped version like:
path.Join("/foo/bar", url.PathEscape("testthis://foo"))
// => /foo/bar/testthis:%2F%2Ffoo
The final path after u.String()
will be escaped again and will become /foo/bar/testthis:%252F%252Ffoo
. That will be ok, but the name in the API would be testthis:%2F%2Ffoo
so we need to do url.PathUnescape(name)
to get the proper name.
Another solution would be to use u.JoinPath()
u := baseURL.JoinPath("foo", "bar", url.PathEscape("testthis://foo"))
// Path => /foo/bar/testthis://foo
// RawPath => /foo/bar/testthis:%2F%2Ffoo
The final string will have probably the cleanest path /foo/bar/testthis:%2F%2Ffoo
but as happens with the previous version we will need to use url.PathUnescape(name)
.
So if there's no other solution, we will need to change most of the endpoints in the client and all the admin methods that can have a name/reference like this.
And obviously, we can always restrict which characters can use in all those names and references.
Steps to Reproduce
Your Environment
step
CLI Version - Smallstep CLI/0.21.0 (darwin/arm64) Release Date: 2022-07-07 01:07 UTCExpected Behavior
Remove the newly created provisioner.
Actual Behavior
json: cannot unmarshal number into Go value of type ca.AdminClientError
(and the provisioner cannot be removed)
Additional Context
No response
Contributing
Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).