IDEA-113883 FileNotFoundException with invalid file name when opening a project on Windows

GitOrigin-RevId: 2fa1da512ef67761add097ab0c5dc69af222a503
This commit is contained in:
Dmitry Avdeev
2023-10-31 16:46:00 +01:00
committed by intellij-monorepo-bot
parent acfe82679d
commit d3da51b48e

View File

@@ -161,6 +161,8 @@ public final class WorkingContextManager {
tasksFolder.mkdirs();
}
String projectName = FileUtil.sanitizeFileName(myProject.getName());
int maxNameLength = 240;
projectName = projectName.length() <= maxNameLength ? projectName : projectName.substring(0, maxNameLength); // make sure archive file name does not exceed 255
return new File(tasksFolder, projectName + postfix);
}