Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for urls to Main #89

Merged
merged 2 commits into from
Dec 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading