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][client] Fix the Windows absolute path not recognized in auth param string #6

Closed
wants to merge 10 commits into from

Conversation

BewareMyPower
Copy link
Owner

Motivation

When the auth param string contains a key-value pair whose value is a Windows absolute path like:

keyStorePath:C:\path\to\client.keystore.jks

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 a ResourceUtils class to convert it to the absolute path like "C:\path\to\file".

…ram string

### Motivation

When the auth param string contains a key-value pair whose value is a
Windows absolute path like:

```
keyStorePath:C:\path\to\client.keystore.jks
```

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 a
`ResourceUtils` class to convert it to the absolute path like
"C:\path\to\file".
@BewareMyPower BewareMyPower deleted the bewaremypower/fix-win-resource-path branch November 24, 2022 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant