diff --git a/src/gql/resolvers/RetourResolver.php b/src/gql/resolvers/RetourResolver.php index 3d24f7b..a41aaca 100644 --- a/src/gql/resolvers/RetourResolver.php +++ b/src/gql/resolvers/RetourResolver.php @@ -76,17 +76,19 @@ public static function resolve(mixed $source, array $arguments, mixed $context, Retour::$plugin->statistics->incrementStatistics($uri, false, $siteId); } } - $dest = $redirect['redirectDestUrl']; - // If this isn't an absolute URL, make it one based on the appropriate site - if (!UrlHelper::isAbsoluteUrl($dest)) { - try { - $dest = UrlHelper::siteUrl($dest, null, null, $siteId); - $dest = parse_url($dest, PHP_URL_PATH); - } catch (Throwable $e) { - // That's ok + if ($redirect !== null) { + $dest = $redirect['redirectDestUrl']; + // If this isn't an absolute URL, make it one based on the appropriate site + if (!UrlHelper::isAbsoluteUrl($dest)) { + try { + $dest = UrlHelper::siteUrl($dest, null, null, $siteId); + $dest = parse_url($dest, PHP_URL_PATH); + } catch (Throwable $e) { + // That's ok + } } + $redirect['redirectDestUrl'] = $dest; } - $redirect['redirectDestUrl'] = $dest; return $redirect; }