File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
solr/core/src/java/org/apache/solr/filestore Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change 3030import java .lang .invoke .MethodHandles ;
3131import java .nio .ByteBuffer ;
3232import java .nio .channels .SeekableByteChannel ;
33+ import java .nio .file .FileSystems ;
3334import java .nio .file .Files ;
3435import java .nio .file .Path ;
3536import java .nio .file .Paths ;
@@ -88,13 +89,13 @@ public Path getRealPath(String path) {
8889 return _getRealPath (path , solrHome );
8990 }
9091
91- private static Path _getRealPath (String dir , Path solrHome ) {
92- Path path = Path . of ( dir );
93- SolrPaths . assertNotUnc ( path );
94-
95- if ( path . isAbsolute ()) {
96- // Strip the path of from being absolute to become relative to resolve with SolrHome
97- path = path .subpath ( 0 , path . getNameCount () );
92+ private static Path _getRealPath (String path , Path solrHome ) {
93+ if ( FileSystems . getDefault (). getSeparator (). equals ( " \\ " )) {
94+ path = path . replace ( "/" , FileSystems . getDefault (). getSeparator () );
95+ }
96+ SolrPaths . assertNotUnc ( Path . of ( path ));
97+ while ( path . startsWith ( FileSystems . getDefault (). getSeparator ())) { // Trim all leading slashes
98+ path = path .substring ( 1 );
9899 }
99100
100101 var finalPath = getFileStoreDirPath (solrHome ).resolve (path );
You can’t perform that action at this time.
0 commit comments