From 0ae520b5ccb279da96e1e047565d149d6c0f6ff7 Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Fri, 23 Oct 2020 16:59:20 +0200 Subject: [PATCH] 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. --- packages/lib/shared_commands.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/lib/shared_commands.js b/packages/lib/shared_commands.js index 3d16bd06..29550cb6 100644 --- a/packages/lib/shared_commands.js +++ b/packages/lib/shared_commands.js @@ -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}`);