Skip to content

Commit

Permalink
?article_id-Weiterleitung nicht bei API-Call und bei POST-Requests (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
gharlan authored Aug 16, 2022
1 parent 5f4dc43 commit fec4223
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
--------------------------

Expand Down
18 changes: 11 additions & 7 deletions lib/yrewrite/yrewrite.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,22 +217,26 @@ 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']);
$url = self::getFullUrlByArticleId($articleId, null, $params, '&');
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);
Expand Down
2 changes: 1 addition & 1 deletion package.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit fec4223

Please sign in to comment.