SOLR-13821: Incorrect file path escape in windows

This commit is contained in:
noble 2019-10-11 11:47:39 +11:00
parent d5b26be691
commit 25ec0ddb73
1 changed files with 2 additions and 2 deletions

View File

@ -89,13 +89,13 @@ public class DistribPackageStore implements PackageStore {
@Override @Override
public Path getRealpath(String path) { public Path getRealpath(String path) {
if (File.separatorChar == '\\') { if (File.separatorChar == '\\') {
path = path.replaceAll("/", File.separator); path = path.replace('/' , File.separatorChar);
} }
if (path.charAt(0) != File.separatorChar) { if (path.charAt(0) != File.separatorChar) {
path = File.separator + path; path = File.separator + path;
} }
return new File(this.coreContainer.getResourceLoader().getInstancePath() + return new File(this.coreContainer.getResourceLoader().getInstancePath() +
"/" + PackageStoreAPI.PACKAGESTORE_DIRECTORY + path).toPath(); File.separator + PackageStoreAPI.PACKAGESTORE_DIRECTORY + path).toPath();
} }
class FileInfo { class FileInfo {