Skip to content

Commit

Permalink
fix: order of routes, strip ~dev suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
Naugrimm committed May 16, 2023
1 parent a947276 commit fc30338
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions src/Controller/RepoController.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,24 @@ public function downloads(Request $request, Organization $organization): JsonRes
return new JsonResponse(['status' => 'success'], JsonResponse::HTTP_CREATED);
}

/**
* @Route("/p2/{package}~dev.json",
* host="{organization}{sep1}repo{sep2}{domain}",
* name="repo_package_provider_v2_dev",
* methods={"GET"},
* defaults={"domain":"%domain%","sep1"="%organization_separator%","sep2"="%domain_separator%"},
* requirements={"domain"="%domain%","package"="%package_name_pattern%","sep1"="%organization_separator%","sep2"="%domain_separator%"})
* @Cache(public=false)
*/
public function providerV2Dev(Request $request, Organization $organization, string $package): JsonResponse
{
if (($package = preg_replace('/~dev$/', '', $package)) === null) {
throw new NotFoundHttpException();
}

return $this->providerV2($request, $organization, $package);
}

/**
* @Route("/p2/{package}.json",
* host="{organization}{sep1}repo{sep2}{domain}",
Expand Down Expand Up @@ -169,20 +187,6 @@ public function providerV2(Request $request, Organization $organization, string
return $response;
}

/**
* @Route("/p2/{package}~dev.json",
* host="{organization}{sep1}repo{sep2}{domain}",
* name="repo_package_provider_v2_dev",
* methods={"GET"},
* defaults={"domain":"%domain%","sep1"="%organization_separator%","sep2"="%domain_separator%"},
* requirements={"domain"="%domain%","package"="%package_name_pattern%","sep1"="%organization_separator%","sep2"="%domain_separator%"})
* @Cache(public=false)
*/
public function providerV2Dev(Request $request, Organization $organization, string $package): JsonResponse
{
return $this->providerV2($request, $organization, $package);
}

/**
* @return array<string, string>
*/
Expand Down

0 comments on commit fc30338

Please sign in to comment.