Skip to content
Snippets Groups Projects

Issue #3066455: Resolve relative URLs to their appropriate alias

Open codebymikey requested to merge issue/rules-3066455:3066455-page-redirect-not into 8.x-3.x
1 file
+ 5
0
Compare changes
  • Side-by-side
  • Inline
@@ -2,9 +2,11 @@
namespace Drupal\rules\Plugin\RulesAction;
use Drupal\Component\Utility\UrlHelper;
use Drupal\Core\Logger\LoggerChannelInterface;
use Drupal\Core\Path\CurrentPathStack;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Url;
use Drupal\rules\Core\RulesActionBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\RequestStack;
@@ -107,6 +109,9 @@ class SystemPageRedirect extends RulesActionBase implements ContainerFactoryPlug
return;
}
if (!UrlHelper::isExternal($url)) {
$url = Url::fromUserInput('/' . ltrim($url, '/'))->toString(TRUE)->getGeneratedUrl();
}
$this->request->attributes->set('_rules_redirect_action_url', $url);
}
Loading