/** * @Route("/{digest}", methods={"GET"}, name="layer_get") * * @ParamConverter(name="layer", options={"mapping": {"digest": "digest"}}) * * @link http://docs.docker.com/registry/spec/api/#existing-layers */ public function getAction(Request $request, Layer $layer) { if ($request->isMethod('HEAD')) { return new Response('', Response::HTTP_OK, ['Docker-Content-Digest' => $layer->getDigest()]); } return new BinaryFileResponse($this->get('layer_manager')->getContentPath($layer), Response::HTTP_OK, ['Docker-Content-Digest' => $layer->getDigest()], false); }
/** * @Route("/{digest}", methods={"GET"}, name="layer_get") * * @ParamConverter(name="repository", options={"mapping": {"name": "name"}}) * @ParamConverter(name="layer", options={"mapping": {"digest": "digest"}}) * * @Security("is_granted('REPO_READ', repository)") * * @link http://docs.docker.com/registry/spec/api/#existing-layers */ public function getAction(Request $request, Repository $repository, Layer $layer) { // FIXME: check that the layer belongs to the repository ? if ($request->isMethod('HEAD')) { return new Response('', Response::HTTP_OK, ['Docker-Content-Digest' => $layer->getDigest()]); } return new BinaryFileResponse($this->get('layer_manager')->getContentPath($layer), Response::HTTP_OK, ['Docker-Content-Digest' => $layer->getDigest()], false); }