Merge pull request #31430 from nextcloud/enh/31429/improve-overwrite-cli-url-check

Validate `overwrite.cli.url` to be a url in setup check
pull/31542/head
Simon L 2 years ago committed by GitHub
commit 3a0b934f84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -614,15 +614,14 @@ Raw output
}
protected function getSuggestedOverwriteCliURL(): string {
$suggestedOverwriteCliUrl = '';
if ($this->config->getSystemValue('overwrite.cli.url', '') === '') {
$suggestedOverwriteCliUrl = $this->request->getServerProtocol() . '://' . $this->request->getInsecureServerHost() . \OC::$WEBROOT;
if (!$this->config->getSystemValue('config_is_read_only', false)) {
// Set the overwrite URL when it was not set yet.
$this->config->setSystemValue('overwrite.cli.url', $suggestedOverwriteCliUrl);
$suggestedOverwriteCliUrl = '';
}
$currentOverwriteCliUrl = $this->config->getSystemValue('overwrite.cli.url', '');
$suggestedOverwriteCliUrl = $this->request->getServerProtocol() . '://' . $this->request->getInsecureServerHost() . \OC::$WEBROOT;
// Check correctness by checking if it is a valid URL
if (filter_var($currentOverwriteCliUrl, FILTER_VALIDATE_URL)) {
$suggestedOverwriteCliUrl = '';
}
return $suggestedOverwriteCliUrl;
}

@ -225,7 +225,7 @@
}
if (data.suggestedOverwriteCliURL !== '') {
messages.push({
msg: t('core', 'If your installation is not installed at the root of the domain and uses system cron, there can be issues with the URL generation. To avoid these problems, please set the "overwrite.cli.url" option in your config.php file to the webroot path of your installation (suggestion: "{suggestedOverwriteCliURL}")', {suggestedOverwriteCliURL: data.suggestedOverwriteCliURL}),
msg: t('core', 'Please make sure to set the "overwrite.cli.url" option in your config.php file to the URL that your users mainly use to access this Nextcloud. Suggestion: "{suggestedOverwriteCliURL}". Otherwise there might be problems with the URL generation via cron. (It is possible though that the suggested URL is not the URL that your users mainly use to access this Nextcloud. Best is to double check this in any case.)', {suggestedOverwriteCliURL: data.suggestedOverwriteCliURL}),
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
});
}

Loading…
Cancel
Save