Skip to content

Commit

Permalink
Merge pull request #89 from ConductionNL/development
Browse files Browse the repository at this point in the history
Fix for urls to Main
  • Loading branch information
rjzondervan authored Dec 4, 2024
2 parents c7a38ff + d60885d commit f11970a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/Service/FileService.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
use OCP\IConfig;
use OCP\IRequest;
use OCP\IURLGenerator;
use OCP\IUserSession;
Expand Down Expand Up @@ -40,6 +41,7 @@ public function __construct(
private readonly IRootFolder $rootFolder,
private readonly IManager $shareManager,
private readonly IURLGenerator $urlGenerator,
private readonly IConfig $config,
) {}

/**
Expand Down Expand Up @@ -88,7 +90,14 @@ public function getShareLink(IShare $share): string
*/
private function getCurrentDomain(): string
{
return $this->urlGenerator->getBaseUrl();
$baseUrl = $this->urlGenerator->getBaseUrl();
$trustedDomains = $this->config->getSystemValue('trusted_domains');

if(isset($trustedDomains[1]) === true) {
$baseUrl = str_replace(search: 'localhost', replace: $trustedDomains[1], subject: $baseUrl);
}

return $baseUrl;
}

/**
Expand Down

0 comments on commit f11970a

Please sign in to comment.