Skip to content

Commit 4191a17

Browse files
committed
improve overwrite cli url setup check
Signed-off-by: szaimen <szaimen@e.mail.de>
1 parent 787f4f0 commit 4191a17

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

apps/settings/lib/Controller/CheckSetupController.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -609,15 +609,14 @@ protected function hasWorkingFileLocking(): bool {
609609
}
610610

611611
protected function getSuggestedOverwriteCliURL(): string {
612-
$suggestedOverwriteCliUrl = '';
613-
if ($this->config->getSystemValue('overwrite.cli.url', '') === '') {
614-
$suggestedOverwriteCliUrl = $this->request->getServerProtocol() . '://' . $this->request->getInsecureServerHost() . \OC::$WEBROOT;
615-
if (!$this->config->getSystemValue('config_is_read_only', false)) {
616-
// Set the overwrite URL when it was not set yet.
617-
$this->config->setSystemValue('overwrite.cli.url', $suggestedOverwriteCliUrl);
618-
$suggestedOverwriteCliUrl = '';
619-
}
612+
$currentOverwriteCliUrl = $this->config->getSystemValue('overwrite.cli.url', '');
613+
$suggestedOverwriteCliUrl = $this->request->getServerProtocol() . '://' . $this->request->getInsecureServerHost() . \OC::$WEBROOT;
614+
615+
// Check correctness by checking if it is a valid URL
616+
if (filter_var($currentOverwriteCliUrl, FILTER_VALIDATE_URL)) {
617+
$suggestedOverwriteCliUrl = '';
620618
}
619+
621620
return $suggestedOverwriteCliUrl;
622621
}
623622

core/js/setupchecks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@
225225
}
226226
if (data.suggestedOverwriteCliURL !== '') {
227227
messages.push({
228-
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}),
228+
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}),
229229
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
230230
});
231231
}

0 commit comments

Comments
 (0)