diff --git a/CHANGELOG.md b/CHANGELOG.md index 36f5391..c0d3b21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,14 @@ Changelog ========= +Version 2.9.1 – 16.08.2022 +-------------------------- + +### Bugfixes + +* Umleitung bei Frontendaufrufen mit `?article_id=X`-Parameter nicht mehr bei API-Aufrufen und bei POST-Requests, um kompatibler zum Verhalten vor v2.9 zu sein (@gharlan) + + Version 2.9.0 – 03.08.2022 -------------------------- diff --git a/lib/yrewrite/yrewrite.php b/lib/yrewrite/yrewrite.php index 9b94d41..77d4d9f 100644 --- a/lib/yrewrite/yrewrite.php +++ b/lib/yrewrite/yrewrite.php @@ -217,7 +217,7 @@ public static function getPathsByDomain($domain) public static function prepare() { - if (rex::isFrontend() && $articleId = rex_request('article_id', 'int')) { + if (rex::isFrontend() && 'get' === rex_request_method() && !rex_get('rex-api-call') && $articleId = rex_get('article_id', 'int')) { $params = $_GET; unset($params['article_id']); unset($params['clang']); @@ -225,14 +225,18 @@ public static function prepare() rex_response::sendRedirect($url, rex_response::HTTP_MOVED_PERMANENTLY); } - if (!isset($_SERVER['REQUEST_URI'])) { - $_SERVER['REQUEST_URI'] = substr($_SERVER['PHP_SELF'], 1); - if (!empty($_SERVER['QUERY_STRING'])) { - $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; + if ($articleId = rex_request('article_id', 'int')) { + $url = rex_getUrl($articleId); + } else { + if (!isset($_SERVER['REQUEST_URI'])) { + $_SERVER['REQUEST_URI'] = substr($_SERVER['PHP_SELF'], 1); + if (!empty($_SERVER['QUERY_STRING'])) { + $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; + } } - } - $url = urldecode($_SERVER['REQUEST_URI']); + $url = urldecode($_SERVER['REQUEST_URI']); + } $resolver = new rex_yrewrite_path_resolver(self::$domainsByName, self::$domainsByMountId, self::$aliasDomains, self::$paths['paths'] ?? [], self::$paths['redirections'] ?? []); $resolver->resolve($url); diff --git a/package.yml b/package.yml index 78582b3..faac7cb 100644 --- a/package.yml +++ b/package.yml @@ -1,5 +1,5 @@ package: yrewrite -version: '2.9.0' +version: '2.9.1' author: Jan Kristinus, Gregor Harlan supportpage: https://github.com/yakamara/redaxo_yrewrite docspage: https://github.com/yakamara/redaxo_yrewrite/edit/main/README.md