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

Catalog.QueryMediaList bugfix #441

Merged
merged 3 commits into from
Mar 3, 2022

Conversation

mikeletux
Copy link
Contributor

Description

Catalog.QueryMediaList method has a bug which prevents from correctly retrieve media list from a given catalog.

Detailed description

While developing some features for the Terraform provider for VCD, I've found out that the method Catalog.QueryMediaList was buggy.
When executing it, it throws an error saying that the URL cannot be parsed.
After some debugging, I saw that the method fmt.Sprintf was being used wrongly:

filter := fmt.Sprintf("catalog==" + url.QueryEscape(catalog.Catalog.HREF))

This was causing that the string returned, instead of having escaped characters appropriately, it contained things like (INVALID) which were crashing the execution.

I fix the issue with the following change:

filter := fmt.Sprintf("catalog==%s", url.QueryEscape(catalog.Catalog.HREF))

Now things are working properly. Also I saw neither Catalog.QueryMediaList nor Catalog.QueryVappTemplateList had tests, so I wrote them! 🚀

Miguel Sama added 2 commits March 2, 2022 17:09
Add test for Catalog.QueryMediaList and Catalog.QueryVappTemplateList

Signed-off-by: Miguel Sama <[email protected]>
Copy link
Collaborator

@adambarreiro adambarreiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

Signed-off-by: Miguel Sama <[email protected]>
Copy link
Collaborator

@lvirbalas lvirbalas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, thanks!

Copy link
Collaborator

@Didainius Didainius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great find

@mikeletux mikeletux merged commit e6f697c into vmware:main Mar 3, 2022
@mikeletux mikeletux deleted the catalog-media-retrieval-bug branch March 3, 2022 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants