-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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 #18403
Merged
nodece
merged 10 commits into
apache:master
from
BewareMyPower:bewaremypower/fix-win-resource-path
Nov 21, 2022
Merged
[fix][client] Fix the Windows absolute path not recognized in auth param string #18403
nodece
merged 10 commits into
apache:master
from
BewareMyPower:bewaremypower/fix-win-resource-path
Nov 21, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…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
added
type/bug
The PR fixed a bug or issue reported a bug
area/client
labels
Nov 10, 2022
BewareMyPower
requested review from
lhotari,
Jason918,
shoothzj,
nodece,
RobertIndie,
tisonkun and
mattisonchao
November 10, 2022 06:20
poorbarcode
approved these changes
Nov 10, 2022
pulsar-broker/src/test/java/org/apache/pulsar/utils/ResourceUtils.java
Outdated
Show resolved
Hide resolved
nodece
reviewed
Nov 10, 2022
pulsar-client/src/main/java/org/apache/pulsar/client/impl/AuthenticationUtil.java
Show resolved
Hide resolved
tisonkun
approved these changes
Nov 14, 2022
nodece
approved these changes
Nov 14, 2022
RobertIndie
approved these changes
Nov 14, 2022
Codecov Report
@@ Coverage Diff @@
## master #18403 +/- ##
=============================================
+ Coverage 31.39% 46.82% +15.42%
- Complexity 6651 10358 +3707
=============================================
Files 697 697
Lines 68015 68026 +11
Branches 7285 7285
=============================================
+ Hits 21353 31850 +10497
+ Misses 43667 32611 -11056
- Partials 2995 3565 +570
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@BewareMyPower Please fix failed tests. |
lifepuzzlefun
pushed a commit
to lifepuzzlefun/pulsar
that referenced
this pull request
Dec 9, 2022
lifepuzzlefun
pushed a commit
to lifepuzzlefun/pulsar
that referenced
this pull request
Jan 10, 2023
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/client
cherry-picked/branch-2.11
doc-not-needed
Your PR changes do not impact docs
release/2.11.1
type/bug
The PR fixed a bug or issue reported a bug
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
pulsar/pulsar-client/src/main/java/org/apache/pulsar/client/impl/AuthenticationUtil.java
Lines 46 to 49 in 0650676
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".Documentation
doc
doc-required
doc-not-needed
doc-complete
Matching PR in forked repository
PR in forked repository: BewareMyPower#6