mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[test framework] rejecting files copied into a project from outside of a test data directory (IDEA-223901)
GitOrigin-RevId: 36efa88bb5303ac83d9356301848c3aa1b6ae1b6
This commit is contained in:
committed by
intellij-monorepo-bot
parent
d38eb1fe8d
commit
368eaa7581
+2
-4
@@ -55,7 +55,6 @@ import com.intellij.openapi.application.ReadAction;
|
||||
import com.intellij.openapi.application.WriteAction;
|
||||
import com.intellij.openapi.command.WriteCommandAction;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.EditorFactory;
|
||||
@@ -350,13 +349,12 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
|
||||
sourceFile = candidate;
|
||||
if (targetPath == sourcePath) {
|
||||
Path testDataPathObj = Paths.get(testDataPath), targetPathObj = Paths.get(targetPath);
|
||||
if (targetPathObj.startsWith(testDataPathObj)) {
|
||||
if (targetPathObj.startsWith(testDataPathObj) && !targetPathObj.equals(testDataPathObj)) {
|
||||
targetPath = testDataPathObj.relativize(targetPathObj).toString();
|
||||
}
|
||||
else {
|
||||
targetPath = targetPathObj.getFileName().toString();
|
||||
throw new IllegalArgumentException("Cannot guess target path for '" + sourcePath + "'; please specify explicitly");
|
||||
}
|
||||
Logger.getInstance(getClass()).warn("Absolute target path '" + sourcePath + "' trimmed to '" + targetPath + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user