From 5ede4b873fc6f737c8fd28b055d64bf243f74395 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20D=C3=BChr?= Date: Wed, 12 Jun 2019 18:05:56 +0200 Subject: [PATCH] extracting language from url was bugged --- src/Controller/ContentApiController.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Controller/ContentApiController.php b/src/Controller/ContentApiController.php index b61e384..22b1060 100644 --- a/src/Controller/ContentApiController.php +++ b/src/Controller/ContentApiController.php @@ -59,8 +59,8 @@ private function init(Request $request): Request if (substr($url, 0, 1) != '/') { $url = "/$url"; } - $urlParts = explode('/', $request->query->get('url')); - $this->lang = count($urlParts) > 0 && strlen($urlParts[0]) == 2 ? $urlParts[0] : null; + $urlParts = explode('/', $url); + $this->lang = count($urlParts) > 1 && strlen($urlParts[1]) == 2 ? $urlParts[1] : null; } if (!$this->lang) { $sitemap = new Sitemap(); @@ -98,7 +98,7 @@ private function init(Request $request): Request public function sitemapAction(Request $request) { $request = $this->init($request); - $sitemap = new Sitemap($this->lang); + $sitemap = new Sitemap($request->query->get('lang', null)); return new ContentApiResponse($sitemap, 200, $this->headers); } @@ -114,7 +114,7 @@ public function sitemapFlatAction(Request $request) { $request = $this->init($request); - return new ContentApiResponse(new SitemapFlat($this->lang), 200, $this->headers); + return new ContentApiResponse(new SitemapFlat($request->query->get('lang', null)), 200, $this->headers); } /**