Skip to content
Merged
Show file tree
Hide file tree
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
15 changes: 7 additions & 8 deletions apps/settings/lib/Controller/CheckSetupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -609,15 +609,14 @@ protected function hasWorkingFileLocking(): bool {
}

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)) {
Copy link
Contributor Author

@szaimen szaimen Mar 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is everyone, especially @juliushaertl fine if we do it like this for now?
After merging, I will rebase Carls PR and change it there to use his validation logic but since I want to backport this we will not have the validation logic in place.
For me the most important change of this PR is to make admins aware of this config which the PR does. Since the warning is only shown in the admin panel, it is in my opinion no big problem if it is sometimes false-positive because of this unperfect filter and will not cause any harm.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, fine with me :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great, thanks! :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

$suggestedOverwriteCliUrl = '';
}

return $suggestedOverwriteCliUrl;
}

Expand Down
2 changes: 1 addition & 1 deletion core/js/setupchecks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
}
Expand Down