dsmiley commented on code in PR #146:
URL: https://github.com/apache/solr/pull/146#discussion_r1041330103
##########
solr/core/src/java/org/apache/solr/core/FileSystemConfigSetService.java:
##########
@@ -287,11 +285,9 @@ public Long getCurrentSchemaModificationVersion(
}
protected Path getConfigDir(String configName) throws IOException {
- String path =
- Paths.get(configSetBase.toString(), FilenameUtils.getName(configName))
- .toFile()
- .getCanonicalPath();
- if (!path.endsWith(configName)) {
+ String configSetBasePath = configSetBase.toString();
+ String path = Path.of(configSetBasePath,
configName).toFile().getCanonicalPath();
+ if (!path.startsWith(configSetBasePath)) {
Review Comment:
No, I meant Path.startsWith(path). In general, hold paths as Path not
String nor File. It's typed, has lots of useful methods, and easier to "get
right" whereas String processing in particular tends to have more subtle bugs.
--
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]