https://bugs.koozali.org/show_bug.cgi?id=12308

            Bug ID: 12308
           Summary: smeserver-nexcloud overwrite.cli.url needs url value
                    escaping and custom url setting
    Classification: Contribs
           Product: SME Contribs
           Version: 10.0
          Hardware: ---
                OS: ---
            Status: CONFIRMED
          Severity: normal
          Priority: P3
         Component: smeserver-nextcloud
          Assignee: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]
  Target Milestone: ---

Current nextcloud-occ-conf produces this on update

"version": "24.0.9.2",
"overwrite.cli.url": "https:\/\/somedomain.com\/nextcloud",

/etc/e-smith/events/actions/nextcloud-occ-conf:114:

    OCC "config:system:set overwrite.cli.url --value 'https://$url'"


Quick patch for this:


diff -ruN /etc/e-smith/events/actions/nextcloud-occ-conf.orig
/etc/e-smith/events/actions/nextcloud-occ-conf
--- /etc/e-smith/events/actions/nextcloud-occ-conf.orig 2023-01-26
13:18:57.660355291 +0000
+++ /etc/e-smith/events/actions/nextcloud-occ-conf      2023-01-25
16:32:34.047618036 +0000
@@ -111,7 +111,7 @@
 #set local domain to send emails
 if ( ($nextcloud->prop('cliurl') ||'enabled') eq 'enabled') {
     my $url= ($VirtualHost eq "")? "$domain/nextcloud" : $VirtualHost;
-    OCC "config:system:set overwrite.cli.url --value 'https://$url'"
+    OCC "config:system:set overwrite.cli.url --value 'https:\/\/$url'"
 }

 # enable files_external and allow auto refresh

Whilst here we should also allow an override to set up your own host.domain if
required. 

eg the primary domain on a server is somedomain.com but it hosts another domain
called anotherdomain.com and runs nextcloud primarily for anotherdomain.com so
needs the correct link of https://www.anotherdomain.com adding in emails.

I propose a key:

config setprop nextcloud OverwriteCliUrl some.domain


This requires an updated patch like this which incorporates the previous fix:


diff -ruN /etc/e-smith/events/actions/nextcloud-occ-conf.orig
/etc/e-smith/events/actions/nextcloud-occ-conf
--- /etc/e-smith/events/actions/nextcloud-occ-conf.orig 2023-01-26
13:18:57.660355291 +0000
+++ /etc/e-smith/events/actions/nextcloud-occ-conf      2023-01-26
13:49:08.930155639 +0000
@@ -109,9 +109,12 @@
 OCC "config:system:set trusted_domains 99 --value=$VirtualHost" unless
$VirtualHost eq "";

 #set local domain to send emails
+my $url = ($nextcloud->prop('OverwriteCliUrl')) || '';
 if ( ($nextcloud->prop('cliurl') ||'enabled') eq 'enabled') {
-    my $url= ($VirtualHost eq "")? "$domain/nextcloud" : $VirtualHost;
-    OCC "config:system:set overwrite.cli.url --value 'https://$url'"
+    unless ( $url ne '') {
+        $url= ($VirtualHost eq "")? "$domain/nextcloud" : $VirtualHost;
+    }
+    OCC "config:system:set overwrite.cli.url --value 'https:\/\/$url'"
 }

 # enable files_external and allow auto refresh


Seemed to work on my test server.

Any thoughts or go ahead and patch?

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
_______________________________________________
Mail for each SME Contribs bug report
To unsubscribe, e-mail [email protected]
Searchable archive at https://lists.contribs.org/mailman/public/contribteam/

Reply via email to