Skip to content

Commit

Permalink
Logo and background URLs must be relative
Browse files Browse the repository at this point in the history
They are used way to often for such a change

Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Apr 24, 2017
1 parent 498cc3e commit 6bf8fee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
10 changes: 5 additions & 5 deletions apps/theming/lib/ThemingDefaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ public function getLogo() {
$cacheBusterCounter = $this->config->getAppValue('theming', 'cachebuster', '0');

if(!$logo || !$logoExists) {
return $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core','logo.svg') . '?v=' . $cacheBusterCounter);
return $this->urlGenerator->imagePath('core','logo.svg') . '?v=' . $cacheBusterCounter;
}

return $this->urlGenerator->linkToRouteAbsolute('theming.Theming.getLogo') . '?v=' . $cacheBusterCounter;
return $this->urlGenerator->linkToRoute('theming.Theming.getLogo') . '?v=' . $cacheBusterCounter;
}

/**
Expand All @@ -169,7 +169,7 @@ public function getBackground() {
return $this->urlGenerator->imagePath('core','background.jpg');
}

return $this->urlGenerator->linkToRouteAbsolute('theming.Theming.getLoginBackground');
return $this->urlGenerator->linkToRoute('theming.Theming.getLoginBackground');
}


Expand All @@ -186,8 +186,8 @@ public function getScssVariables() {
'theming-cachebuster' => "'" . $this->config->getAppValue('theming', 'cachebuster', '0') . "'",
];

$variables['image-logo'] = "'".$this->getLogo()."'";
$variables['image-login-background'] = "'".$this->getBackground()."'";
$variables['image-logo'] = "'".$this->urlGenerator->getAbsoluteURL($this->getLogo())."'";
$variables['image-login-background'] = "'".$this->urlGenerator->getAbsoluteURL($this->getBackground())."'";

if ($this->config->getAppValue('theming', 'color', null) !== null) {
if ($this->util->invertTextColor($this->getColorPrimary())) {
Expand Down
9 changes: 3 additions & 6 deletions apps/theming/tests/ThemingDefaultsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,7 @@ public function testGetBackgroundCustom() {
->method('getAppValue')
->with('theming', 'backgroundMime', false)
->willReturn('image/svg+xml');
$expected = $this->urlGenerator->linkToRouteAbsolute('theming.Theming.getLoginBackground');
$this->assertEquals($expected, $this->template->getBackground());
$this->assertEquals('/index.php/apps/theming/loginbackground', $this->template->getBackground());
}

public function testGetLogoDefault() {
Expand All @@ -455,8 +454,7 @@ public function testGetLogoDefault() {
->method('getFolder')
->with('images')
->willThrowException(new \Exception());
$expected = $this->urlGenerator->getAbsoluteURL('/core/img/logo.svg') . '?v=0';
$this->assertEquals($expected, $this->template->getLogo());
$this->assertEquals('/core/img/logo.svg?v=0', $this->template->getLogo());
}

public function testGetLogoCustom() {
Expand All @@ -478,8 +476,7 @@ public function testGetLogoCustom() {
->method('getAppValue')
->with('theming', 'cachebuster', '0')
->willReturn('0');
$expected = $this->urlGenerator->getAbsoluteURL('index.php/apps/theming/logo') . '?v=0';
$this->assertEquals($expected, $this->template->getLogo());
$this->assertEquals('/index.php/apps/theming/logo?v=0', $this->template->getLogo());
}

public function testGetScssVariablesCached() {
Expand Down

0 comments on commit 6bf8fee

Please sign in to comment.