Skip to content

Commit

Permalink
fix: fix: Fixed an issue where Short Links wouldn't work properly if …
Browse files Browse the repository at this point in the history
…they were added to Asset elements ([#300](#300))
  • Loading branch information
khalwat committed Jun 13, 2024
1 parent 632943a commit 68e3318
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/services/Redirects.php
Original file line number Diff line number Diff line change
Expand Up @@ -991,14 +991,18 @@ public function enableElementRedirect(ElementInterface $element, string $sourceU
{
$siteId = $element->siteId;

$destUrl = $redirectSrcMatch === 'pathonly' ? $element->uri : $element->getUrl();
if ($destUrl === null) {
$destUrl = $element->getUrl();
}
$redirectConfig = [
'redirectMatchType' => 'exactmatch',
'redirectSrcUrl' => $sourceUrl,
'siteId' => $siteId,
'associatedElementId' => $element->getCanonicalId(),
'enabled' => $element->getEnabledForSite($siteId),
'redirectSrcMatch' => $redirectSrcMatch,
'redirectDestUrl' => $redirectSrcMatch === 'pathonly' ? $element->uri : $element->getUrl(),
'redirectDestUrl' => $destUrl,
'redirectHttpCode' => $redirectHttpCode,
];

Expand Down

0 comments on commit 68e3318

Please sign in to comment.