Skip to content

Commit fec4223

Browse files
authored
?article_id-Weiterleitung nicht bei API-Call und bei POST-Requests (#497)
1 parent 5f4dc43 commit fec4223

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
Changelog
22
=========
33

4+
Version 2.9.1 – 16.08.2022
5+
--------------------------
6+
7+
### Bugfixes
8+
9+
* 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)
10+
11+
412
Version 2.9.0 – 03.08.2022
513
--------------------------
614

lib/yrewrite/yrewrite.php

+11-7
Original file line numberDiff line numberDiff line change
@@ -217,22 +217,26 @@ public static function getPathsByDomain($domain)
217217

218218
public static function prepare()
219219
{
220-
if (rex::isFrontend() && $articleId = rex_request('article_id', 'int')) {
220+
if (rex::isFrontend() && 'get' === rex_request_method() && !rex_get('rex-api-call') && $articleId = rex_get('article_id', 'int')) {
221221
$params = $_GET;
222222
unset($params['article_id']);
223223
unset($params['clang']);
224224
$url = self::getFullUrlByArticleId($articleId, null, $params, '&');
225225
rex_response::sendRedirect($url, rex_response::HTTP_MOVED_PERMANENTLY);
226226
}
227227

228-
if (!isset($_SERVER['REQUEST_URI'])) {
229-
$_SERVER['REQUEST_URI'] = substr($_SERVER['PHP_SELF'], 1);
230-
if (!empty($_SERVER['QUERY_STRING'])) {
231-
$_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
228+
if ($articleId = rex_request('article_id', 'int')) {
229+
$url = rex_getUrl($articleId);
230+
} else {
231+
if (!isset($_SERVER['REQUEST_URI'])) {
232+
$_SERVER['REQUEST_URI'] = substr($_SERVER['PHP_SELF'], 1);
233+
if (!empty($_SERVER['QUERY_STRING'])) {
234+
$_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
235+
}
232236
}
233-
}
234237

235-
$url = urldecode($_SERVER['REQUEST_URI']);
238+
$url = urldecode($_SERVER['REQUEST_URI']);
239+
}
236240

237241
$resolver = new rex_yrewrite_path_resolver(self::$domainsByName, self::$domainsByMountId, self::$aliasDomains, self::$paths['paths'] ?? [], self::$paths['redirections'] ?? []);
238242
$resolver->resolve($url);

package.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package: yrewrite
2-
version: '2.9.0'
2+
version: '2.9.1'
33
author: Jan Kristinus, Gregor Harlan
44
supportpage: https://github.com/yakamara/redaxo_yrewrite
55
docspage: https://github.com/yakamara/redaxo_yrewrite/edit/main/README.md

0 commit comments

Comments
 (0)