isaric commented on code in PR #5373:
URL: https://github.com/apache/solr/pull/5373#discussion_r4709640221


##########
solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.java:
##########
@@ -79,13 +79,19 @@ private static String addNormalV2ApiRoot(String basePath) 
throws MalformedURLExc
   }
 
   private static String buildReplacementV2Path(String existingPath) {
-    if (existingPath.contains("/solr")) {
-      return existingPath.replaceFirst("/solr", "/api");
-    } else if (existingPath.endsWith("/api")) {
+    if (existingPath.endsWith("/api")) {

Review Comment:
   Nit, pre-existing: a base path with a trailing slash (`/solr/`, 
`/tenant/solr/`) yields `/api//collections/...`. The Jetty builder strips the 
slash, but `HttpJdkSolrClient` passes an override base URL straight through, so 
trimming a trailing `/` here would close it cheaply. Fine as a follow-up.



##########
solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.java:
##########
@@ -79,13 +79,19 @@ private static String addNormalV2ApiRoot(String basePath) 
throws MalformedURLExc
   }
 
   private static String buildReplacementV2Path(String existingPath) {

Review Comment:
   Nit: a one-line javadoc stating the rule would help, since the test is now 
the only place that documents it: replace the last complete `/solr` segment, 
keep an existing `/api` root, otherwise append `/api`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to