PY-76629: PY-76714: Handle empty string of bundled stubs path

findPathStringInHelpers might return an empty string,
that will be equal to the home path,
that will lead to indexing of the home directory.

GitOrigin-RevId: e800896a4c0631844a7b7a3a79334c3853a30c32
This commit is contained in:
Ilia Zakoulov
2024-10-21 13:47:44 +02:00
committed by intellij-monorepo-bot
parent ab53444089
commit 948779f507

View File

@@ -508,7 +508,11 @@ public final class PythonSdkUpdater {
}
private static @NotNull List<VirtualFile> getBundledStubs() {
VirtualFile bundledStubRoot = StandardFileSystems.local().findFileByPath(PythonHelpersLocator.findPathStringInHelpers("bundled_stubs"));
var helpersPath = PythonHelpersLocator.findPathStringInHelpers("bundled_stubs");
if (helpersPath.isEmpty()) {
return Collections.emptyList();
}
VirtualFile bundledStubRoot = StandardFileSystems.local().findFileByPath(helpersPath);
if (bundledStubRoot == null) return Collections.emptyList();
return List.of(bundledStubRoot);
}