Skip to content

Commit

Permalink
Sub repo public access
Browse files Browse the repository at this point in the history
  • Loading branch information
vtsykun committed Nov 9, 2024
1 parent 2a6a3a2 commit b6e5fd2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/Controller/ProviderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,17 @@ public function packageV2Action(Request $request, string $package): Response
{
$isDev = str_ends_with($package, '~dev');
$packageName = preg_replace('/~dev$/', '', $package);
if (!$this->checkSubrepositoryAccess($packageName)) {
return $this->createNotFound();
}

$response = new JsonResponse([]);
$response->setLastModified($this->providerManager->getLastModify($package));
if ($response->isNotModified($request)) {
return $response;
}

if (!$this->checkSubrepositoryAccess($packageName)) {
return $this->createNotFound();
}

$package = $this->packageManager->getPackageV2Json($this->getUser(), $packageName, $isDev);
if (!$package) {
return $this->createNotFound();
Expand Down
4 changes: 2 additions & 2 deletions src/Package/InMemoryDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ private function dumpRootPackages(?UserInterface $user = null, ?int $apiVersion
$url = $this->router->generate('track_download', ['name' => 'VND/PKG']);
$slug = $subRepo && !$this->subRepositoryHelper->isAutoHost() ? '/'. $subRepo->getSlug() : '';

$rootFile['notify'] = str_replace('VND/PKG', '%package%', $url);
$rootFile['notify-batch'] = $this->router->generate('track_download_batch');
$rootFile['notify'] = $slug . str_replace('VND/PKG', '%package%', $url);
$rootFile['notify-batch'] = $slug . $this->router->generate('track_download_batch');
$rootFile['metadata-changes-url'] = $this->router->generate('metadata_changes');
$rootFile['providers-url'] = $slug . '/p/%package%$%hash%.json';

Expand Down

0 comments on commit b6e5fd2

Please sign in to comment.