[fix][client] Fix the Windows absolute path not recognized in auth param string #6
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.
Motivation
When the auth param string contains a key-value pair whose value is a Windows absolute path like:
The path will be discarded. See
https://github.com/apache/pulsar/blob/06506761aff0eae4acbffa68c3431d2c96affe29/pulsar-client/src/main/java/org/apache/pulsar/client/impl/AuthenticationUtil.java#L46-L49
Modifications
When a key-value string can be split into more than 2 tokens by ':', treat the 1st token as the key, and the following part as the value.
In addition, fix some tests cannot run on Windows because of the
URL#getPath
might return something like "/C:/path/to/file". Add aResourceUtils
class to convert it to the absolute path like "C:\path\to\file".