Skip to content

Commit

Permalink
Merge pull request #83 from ConductionNL/development
Browse files Browse the repository at this point in the history
Development to main
  • Loading branch information
rjzondervan authored Dec 3, 2024
2 parents 11015ae + 1fa7269 commit 7d8693f
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions lib/Service/FileService.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
use OCP\IRequest;
use OCP\IURLGenerator;
use OCP\IUserSession;
use OCP\Lock\LockedException;
use OCP\Share\IManager;
Expand All @@ -37,7 +38,8 @@ public function __construct(
private readonly IUserSession $userSession,
private readonly LoggerInterface $logger,
private readonly IRootFolder $rootFolder,
private readonly IManager $shareManager
private readonly IManager $shareManager,
private readonly IURLGenerator $urlGenerator,
) {}

/**
Expand Down Expand Up @@ -86,15 +88,7 @@ public function getShareLink(IShare $share): string
*/
private function getCurrentDomain(): string
{
// Check if the request is over HTTPS
$isHttps = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off';
$protocol = $isHttps ? 'https://' : 'http://';

// Get the host (domain)
$host = $_SERVER['HTTP_HOST'];

// Construct the full URL
return $protocol . $host;
return $this->urlGenerator->getBaseUrl();
}

/**
Expand Down

0 comments on commit 7d8693f

Please sign in to comment.