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

Fix Edge Case in Query Parameter Parsing #34459

Merged
merged 8 commits into from
Apr 21, 2023

Conversation

alzimmermsft
Copy link
Member

@alzimmermsft alzimmermsft commented Apr 14, 2023

Description

Fixes an edge case found in query parameter parsing for query parameters with no value, ex key&key2=value2.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@alzimmermsft alzimmermsft added Client This issue points to a problem in the data-plane of the library. Azure.Core azure-core labels Apr 14, 2023
@alzimmermsft alzimmermsft self-assigned this Apr 14, 2023
@azure-sdk
Copy link
Collaborator

azure-sdk commented Apr 14, 2023

API change check

APIView has identified API level changes in this PR and created following API reviews.

azure-core

@alzimmermsft
Copy link
Member Author

/azp run java - core

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@alzimmermsft alzimmermsft changed the title Revert Empty Query Param Value Change in UrlBuilder Fix Edge Case in Query Parameter Parsing Apr 14, 2023
* @param queryParameters The query parameter string.
* @return An {@link Iterator} over the query parameter key-value pairs.
*/
public static Iterator<Map.Entry<String, String>> parseQueryParameters(String queryParameters) {
Copy link
Member

@srnagar srnagar Apr 14, 2023

Choose a reason for hiding this comment

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

We should return Map<String, String> instead of the iterator and the implementation could be a LinkedHashMap to preserve the order.

Copy link
Member Author

Choose a reason for hiding this comment

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

This API would need to change to Map<String, QuertyParameter> or Map<String, List<String>> in this case, the current design is to iterate over all parsed query parameters and let the caller handle using or storing them.

@alzimmermsft alzimmermsft merged commit 60aeca8 into Azure:main Apr 21, 2023
49 checks passed
@alzimmermsft alzimmermsft deleted the AzCore_RevertUrlBuilderChange branch April 21, 2023 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Azure.Core azure-core Client This issue points to a problem in the data-plane of the library.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants