Fix Certificate retrieval when its alias has special characters #589
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bug description
When a Certificate inside the library contained a
:
in the alias (name), the functionsClient.GetCertificateFromLibraryByName
andAdminOrg.GetCertificateFromLibraryByName
are not able to find it, returning an ENF (Entity Not Found) error.How to reproduce
Given any VCD version, it is as simple as changing the certificate name in the tests, for example:
Fix
The function
shouldDoSlowSearch
documentation made the following statements:However, if one uses Postman to send the following query in VCD 10.4.x:
It returns the error:
So, the statements are false. For this reason, this PR removes the VCD version check in shouldDoSlowSearch, as this issue happens always and independent of the VCD version.
This PR also removes the
url.QueryEscape
inside shouldDoSlowSearch:This operation is wrong, as the OpenAPI generic calls to retrieve all items also escape the parameters:
So in result, the
alias==%s
filter was encoded twice, causing the VCD filter processor to fail when the alias has special characters like:
, as they're encoded twice.Tests
Tested in 10.4.2