risdenk commented on code in PR #1122:
URL: https://github.com/apache/solr/pull/1122#discussion_r1004711290
##########
solr/core/src/java/org/apache/solr/servlet/LoadAdminUiServlet.java:
##########
@@ -70,20 +67,13 @@ public void doGet(HttpServletRequest _request,
HttpServletResponse _response) th
// We have to close this to flush OutputStreamWriter buffer
out =
new OutputStreamWriter(
- new CloseShieldOutputStream(response.getOutputStream()),
StandardCharsets.UTF_8);
+ CloseShieldOutputStream.wrap(response.getOutputStream()),
StandardCharsets.UTF_8);
- String html = IOUtils.toString(in, "UTF-8");
Package pack = SolrCore.class.getPackage();
-
- String[] search = new String[] {"${contextPath}", "${adminPath}",
"${version}"};
- String[] replace =
- new String[] {
- StringEscapeUtils.escapeEcmaScript(request.getContextPath()),
-
StringEscapeUtils.escapeEcmaScript(CommonParams.CORES_HANDLER_PATH),
-
StringEscapeUtils.escapeEcmaScript(pack.getSpecificationVersion())
- };
-
- out.write(StringUtils.replaceEach(html, search, replace));
+ String html =
+ IOUtils.toString(in, StandardCharsets.UTF_8)
+ .replace("${version}", pack.getSpecificationVersion());
+ out.write(html);
Review Comment:
No we don't - copying for completeness the research I did on jira:
* SOLR-10042 removed adminPath and contextPath -
https://github.com/apache/solr/commit/21384b5b215a68233cb3ef9edaea14be935570b9
* SOLR-4311 originally added the version escaping which just happened to
follow the previous adminPath/contextPath.
https://github.com/apache/solr/commit/5b6b0776ef109c8dd09f2437700bd4460e274c84
* I checked the escaping rules and the version string rules - there is no
need to escape the version string at all.
--
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]