mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-12 15:04:52 +09:00
Fix plugin add command incorrectly resolving path
Fix the plugin add command not storing the resolved path for relative paths passed to it into plugin-list.json and incorrectly resolving any path containing ./ or ../ instead of only paths starting with these.
This commit is contained in:
1 parent
1b0b245484
commit
0ae520b5cc
1 file changed
+2
-2
@@ -39,7 +39,7 @@ async function handlePluginCommand(args, pluginList, pluginListPath) {
|
||||
|
||||
if (command === "add") {
|
||||
let pluginPath = args.path;
|
||||
if (/\.\.?[\/\\]/.test(pluginPath)) {
|
||||
if (/^\.\.?[\/\\]/.test(pluginPath)) {
|
||||
pluginPath = path.resolve(pluginPath);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ async function handlePluginCommand(args, pluginList, pluginListPath) {
|
||||
return;
|
||||
}
|
||||
|
||||
pluginList.set(pluginInfo.name, args.path);
|
||||
pluginList.set(pluginInfo.name, pluginPath);
|
||||
await fs.outputFile(pluginListPath, JSON.stringify([...pluginList], null, 4));
|
||||
console.log(`Added ${pluginInfo.name}`);
|
||||
|
||||
|
||||
Reference in new issue
Block a user