nextcloud: Fix issue with upgrading to next version

Don't delete overwrite.cli.url when the Nextcloud app's settings are
updated with no domain configured. Instead, set it to the default value
of http://localhost/nextcloud

We might want to consider updating existing, faulty setups.

Helps: #2433

Signed-off-by: Benedek Nagy <contact@nbenedek.me>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Benedek Nagy 2024-09-18 23:35:25 +02:00 committed by Sunil Mohan Adapa
parent 7e7ad62c8b
commit 1dabc220b4
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2

View File

@ -119,7 +119,7 @@ def get_override_domain():
def set_override_domain(domain_name: str):
"""Set the domain name that Nextcloud will use to override all domains."""
protocol = 'https'
if domain_name.endswith('.onion'):
if domain_name.endswith('.onion') or not domain_name:
protocol = 'http'
if domain_name:
@ -130,7 +130,8 @@ def set_override_domain(domain_name: str):
else:
_run_occ('config:system:delete', 'overwritehost')
_run_occ('config:system:delete', 'overwriteprotocol')
_run_occ('config:system:delete', 'overwrite.cli.url')
_run_occ('config:system:set', 'overwrite.cli.url', '--value',
f'{protocol}://localhost/nextcloud')
# Restart to apply changes immediately
action_utils.service_restart('nextcloud-freedombox')