-
Notifications
You must be signed in to change notification settings - Fork 534
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 (jkube-kit) : Don't pass Invalid port in host headers for Helm OCI push #2418
Conversation
Eclipse JKube CI ReportStarted new GH workflow run for #2418 (2023-10-11T09:05:42Z) ⚙️ JKube E2E Tests (6480092030)
|
Codecov Report
@@ Coverage Diff @@
## master #2418 +/- ##
============================================
+ Coverage 59.36% 61.15% +1.79%
- Complexity 4586 4803 +217
============================================
Files 500 518 +18
Lines 21211 21399 +188
Branches 2830 2827 -3
============================================
+ Hits 12591 13087 +496
+ Misses 7370 7089 -281
+ Partials 1250 1223 -27
... and 71 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
String hostStr = baseUrl.getHost(); | ||
String portStr = baseUrl.getPort() > 0 ? (":" + baseUrl.getPort()) : EMPTY; | ||
return String.format("%s%s", hostStr, portStr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit
This is extremely verbose and complicated to read. You're mixing template strings with ternaries and string concatenation.
Something like:
final StringBuilder host = new StringBuilder(baseUrl.getHost());
if (baseUrl.getPort() > 0 && baseUrl.getPort() != 80 && baseUrl.getPort() != 443) {
test.append(":").append(baseUrl.getPort());
}
System.out.println(test.toString());
is easier to understand and doesn't mix 3 different ways of concatenating strings.
…I push Passing host:port seems to work when host url contains a valid port. However, this becomes host:-1 for some host that doesn't contain port in URL string (like r.example.com). Add case for these kind of hosts so that we pass correct host in Host HTTP headers. Signed-off-by: Rohan Kumar <[email protected]>
1f35443
to
78a7459
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs 100.0% Coverage The version of Java (11.0.18) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17. |
Description
Passing host:port seems to work when host url contains a valid port. However, this becomes host:-1 for some host that doesn't contain port in URL string (like r.example.com). Add case for these kind of hosts so that we pass correct host in Host HTTP headers.
Fixes #2417
Type of change
test, version modification, documentation, etc.)
Checklist