From 279a9e6b5249ebb213de8fc915a67447dfa63f4b Mon Sep 17 00:00:00 2001 From: Lukas Kurucz Date: Tue, 13 Jun 2023 03:53:18 -0700 Subject: [PATCH] fix: prefixed plugin package name (#4811) Summary: When distributing plugin over Marketplace. Currently there is an issue with downloading a plugin to `tmp` folder if the plugin `packageName` starts with `company-prefix/flipper-plugin-name`. It would throw `ENONET` error while trying to stream the response data into `tmp` folder. ## Changelog - add support for prefixed plugin package names (`shopify/flipper-plugin-name`,...) Pull Request resolved: https://github.com/facebook/flipper/pull/4811 Test Plan: - Try install a plugin from Marketplace which has `/` in the plugin `package.json` `name`. Reviewed By: lblasa Differential Revision: D46679195 Pulled By: passy fbshipit-source-id: f330896dae9da7cbe101b1c6d7ed07667fb7ae0a --- desktop/flipper-server-core/src/plugins/PluginManager.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/desktop/flipper-server-core/src/plugins/PluginManager.tsx b/desktop/flipper-server-core/src/plugins/PluginManager.tsx index 23ee8d606..8ba356436 100644 --- a/desktop/flipper-server-core/src/plugins/PluginManager.tsx +++ b/desktop/flipper-server-core/src/plugins/PluginManager.tsx @@ -27,6 +27,7 @@ import { getInstalledPluginDetails, getInstalledPlugins, getPluginVersionInstallationDir, + getPluginDirNameFromPackageName, installPluginFromFile, removePlugins, getUpdatablePlugins, @@ -129,7 +130,10 @@ export class PluginManager { `Downloading plugin "${title}" v${version} from "${downloadUrl}" to "${installationDir}".`, ); const tmpDir = await getTempDirName(); - const tmpFile = path.join(tmpDir, `${name}-${version}.tgz`); + const tmpFile = path.join( + tmpDir, + `${getPluginDirNameFromPackageName(name)}-${version}.tgz`, + ); try { const cancelationSource = axios.CancelToken.source(); if (await fs.pathExists(installationDir)) {