Hello,
I am new to app development in Nextcloud. Is there a method to get the base URL of public.php ?
For now I have made this function:
private function getNextcloudBasePath() {
if ($this->config->getSystemValueBool(‘htaccess.IgnoreFrontController’, false) || getenv(‘front_controller_active’) === ‘true’) {
return $this->urlGenerator->getWebroot();
} else {
return $this->urlGenerator->getWebroot() . ‘/index.php’;
}
}
That I use like this:
$downloadUrlPrefix = $this->getNextcloudBasePath().‘/public.php/dav/files/’.$shareToken;
Which leads to a wrong url `/index.php/public.php` on instances where pretty URL aren’t enabled. I was about to adapt my function but was wondering if something was usable in core to do this.