From b3fe781c196e0e58e7b229e41d83404fc0e4ffa2 Mon Sep 17 00:00:00 2001 From: billz Date: Wed, 19 Feb 2025 06:03:07 -0800 Subject: [PATCH] Prepend this->rootPath if not absolute path --- src/RaspAP/Plugins/PluginInstaller.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/RaspAP/Plugins/PluginInstaller.php b/src/RaspAP/Plugins/PluginInstaller.php index 374a6afd..57846b05 100644 --- a/src/RaspAP/Plugins/PluginInstaller.php +++ b/src/RaspAP/Plugins/PluginInstaller.php @@ -300,7 +300,12 @@ class PluginInstaller { foreach ($configurations as $config) { $source = escapeshellarg($pluginDir . DIRECTORY_SEPARATOR . $config['source']); - $destination = escapeshellarg($config['destination']); + $destination = $config['destination']; + + if (!str_starts_with($destination, '/')) { + $destination = $this->rootPath . '/' . ltrim($destination, '/'); + } + $destination = escapeshellarg($destination); $cmd = sprintf('sudo /etc/raspap/plugins/plugin_helper.sh config %s %s', $source, $destination); $return = shell_exec($cmd); if (strpos(strtolower($return), 'ok') === false) {