You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by "mlsorensen (via GitHub)" <gi...@apache.org> on 2023/03/22 16:05:37 UTC

[GitHub] [cloudstack-go] mlsorensen commented on a diff in pull request #49: fix asterisk encoding

mlsorensen commented on code in PR #49:
URL: https://github.com/apache/cloudstack-go/pull/49#discussion_r1145067131


##########
cloudstack/cloudstack.go:
##########
@@ -464,17 +464,24 @@ func (cs *CloudStackClient) newRawRequest(api string, post bool, params url.Valu
 	params.Set("command", api)
 	params.Set("response", "json")
 
-	// Generate signature for API call
+	// encode parameters
 	// * Serialize parameters, URL encoding only values and sort them by key, done by encodeValues
+	// * Replace encoded asterisk (*) back to literal.
+	//    CloudStack’s internal encoder does not encode them; this results in an authentication failure for your API call.
+	//    http://docs.cloudstack.apache.org/projects/archived-cloudstack-getting-started/en/latest/dev.html
+	// 	  Not documented http://docs.cloudstack.apache.org/en/latest/developersguide/dev.html#the-cloudstack-api
+	encodedParams := encodeValues(params)
+	encodedParams = strings.Replace(encodedParams, "%2A", "*", -1)

Review Comment:
   It does, you can't set a value with an asterisk via cloud monkey.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org