Skip to content

Commit

Permalink
Issue #4826 Corrected static redirection.
Browse files Browse the repository at this point in the history
  • Loading branch information
CaMer0n committed Jul 26, 2022
1 parent dbd8cee commit a181afc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 5 additions & 2 deletions e107_handlers/redirection_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -465,9 +465,12 @@ public function redirectStaticDomain()
return false;
}

if(strpos($this->subdomain, 'static') !== false)
$tmp = explode('.',$this->domain);

if(!empty($tmp[0]) && strpos($tmp[0], 'static') !== false)
{
return str_replace($this->subdomain.'.'.$this->domain.'/', $this->domain.'/', $this->self);
unset($tmp[0]);
return str_replace($this->domain.'/', implode('.',$tmp).'/', $this->self);
}

return false;
Expand Down
3 changes: 1 addition & 2 deletions e107_tests/tests/unit/redirectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ public function testRedirectStaticDomain()
$result = $this->rd->redirectStaticDomain();
$this->assertEmpty($result);

$this->rd->domain = 'e107.org';
$this->rd->subdomain = 'static1';
$this->rd->domain = 'static1.e107.org';
$this->rd->staticDomains = ['https://static1.e107.org', 'https://static2.e107.org'];

$this->rd->self = 'https://static1.e107.org/blogs';
Expand Down

0 comments on commit a181afc

Please sign in to comment.