mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[platform] includes web token file into config import filter (IDEA-CR-42533)
This commit is contained in:
@@ -21,7 +21,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
@@ -327,9 +326,8 @@ public class ConfigImportHelper {
|
||||
}
|
||||
|
||||
// copy everything including plugins (the plugin manager will sort out incompatible ones)
|
||||
// the filter prevents accidental overwrite of files already created by this instance (port/lock/tokens etc.)
|
||||
FileFilter filter = child -> !(child.getParentFile() == oldConfigDir && new File(newConfigDir, child.getName()).exists());
|
||||
FileUtil.copyDir(oldConfigDir, newConfigDir, filter);
|
||||
// the filter prevents web token reuse and accidental overwrite of files already created by this instance (port/lock/tokens etc.)
|
||||
FileUtil.copyDir(oldConfigDir, newConfigDir, path -> !blockImport(path, oldConfigDir, newConfigDir));
|
||||
|
||||
// on macOS, plugins are normally not under the config directory
|
||||
File oldPluginsDir = new File(oldConfigDir, PLUGINS);
|
||||
@@ -369,4 +367,8 @@ public class ConfigImportHelper {
|
||||
Main.showMessage(ApplicationBundle.message("title.settings.import.failed"), message, false);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean blockImport(File path, File oldConfig, File newConfig) {
|
||||
return path.getParentFile() == oldConfig && ("user.web.token".equals(path.getName()) || new File(newConfig, path.getName()).exists());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user