File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
src/Model/SchemaDefinition Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -210,17 +210,18 @@ private function getLocalRefPath(string $jsonSchemaFile): ?string
210210 $ jsonSchemaFile = str_replace ('\\' , '/ ' , $ jsonSchemaFile );
211211
212212 // relative paths to the current location
213- if (!str_starts_with ( $ jsonSchemaFile , ' / ' )) {
213+ if (!preg_match ( ' #^(?:[A-Za-z]:/|/)# ' , $ jsonSchemaFile , $ match )) {
214214 $ candidate = $ this ->normalizePath ($ currentDir . '/ ' . $ jsonSchemaFile );
215215 return file_exists ($ candidate ) ? $ candidate : null ;
216216 }
217217
218+ $ absolutePathPrefix = $ match [0 ];
218219 // absolute paths: traverse up to find the context root directory
219- $ relative = ltrim ($ jsonSchemaFile , ' / ' );
220+ $ relative = substr ($ jsonSchemaFile , strlen ( $ absolutePathPrefix ) );
220221
221222 $ dir = $ currentDir ;
222223 while (true ) {
223- $ candidate = $ this ->normalizePath ($ dir . '/ ' . $ relative );
224+ $ candidate = $ absolutePathPrefix . $ this ->normalizePath ($ dir . '/ ' . $ relative );
224225 if (file_exists ($ candidate )) {
225226 return $ candidate ;
226227 }
You can’t perform that action at this time.
0 commit comments