Skip to content

Commit

Permalink
fix(修复下载插件失败): 修复下载插件时,因space字段重叠拼接导致插件识别错误 (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
sinceleo authored Aug 3, 2024
1 parent b033e4b commit d1d72df
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/Command/DownloadCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ class DownloadCommand extends AbstractCommand
public function __invoke(): int
{
$identifier = $this->input->getArgument('identifier');
[$space, $identifier] = explode('/', $identifier);
$version = $this->input->getArgument('version');
$appStoreService = ApplicationContext::getContainer()->get(AppStoreService::class);
$appStoreService->download($space, $identifier, $version);
$appStoreService->download($identifier, $version);
$this->output->success('Plugin Downloaded Successfully');
return AbstractCommand::SUCCESS;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Service/AppStoreService.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function request(string $uri, array $data = []): array;
/**
* Download the specified plug-in to a local directory.
*/
public function download(string $space, string $identifier, string $version): bool;
public function download(string $identifier, string $version): bool;

/**
* Get the details of the specified plugin.
Expand Down
4 changes: 2 additions & 2 deletions src/Service/Impl/AppStoreServiceImpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ public function getOtherApp(string $username): array
/**
* Download the specified plug-in to a local directory.
*/
public function download(string $space, string $identifier, string $version): bool
public function download(string $identifier, string $version): bool
{
$localPluginPath = Plugin::PLUGIN_PATH . DIRECTORY_SEPARATOR . $identifier;
if (file_exists($localPluginPath)) {
throw new \RuntimeException(sprintf('The plugin %s already exists', $identifier));
}

$originData = $this->request(__FUNCTION__, [
'identifier' => $space . '/' . $identifier,
'identifier' => $identifier,
'version' => $version,
]);
$downloadResponse = Collection::make($originData);
Expand Down

0 comments on commit d1d72df

Please sign in to comment.