Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/richdocuments.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMuhammet Kara <muhammet.kara@collabora.com>2020-11-16 14:55:11 +0300
committerMuhammet Kara <muhammet.kara@collabora.com>2020-11-16 14:55:53 +0300
commitcb4653c934de161731a42ba00e626ffcbec8e480 (patch)
tree04d1531cd2057f46acfe1d0c3e87d4da1a20dcd6 /lib
parentc016cc9df8be662f82b95f457275f9d76f275a97 (diff)
Adapt built-in CODE url on host address change
Signed-off-by: Muhammet Kara <muhammet.kara@collabora.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/AppInfo/Application.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
index c2e78e3b..7b72e938 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -167,18 +167,24 @@ class Application extends App {
if ($this->getContainer()->getServer()->getAppManager()->isEnabledForUser($CODEAppID)) {
$appConfig = $this->getContainer()->query(AppConfig::class);
$wopi_url = $appConfig->getAppValue('wopi_url');
+ $isCODEEnabled = strpos($wopi_url, 'proxy.php?req=') !== false;
- // Check if we have the wopi_url set currently
- if ($wopi_url !== null && $wopi_url !== '') {
+ // Check if we have the wopi_url set to custom currently
+ if ($wopi_url !== null && $wopi_url !== '' && $isCODEEnabled === false) {
return;
}
$urlGenerator = \OC::$server->getURLGenerator();
$relativeUrl = $urlGenerator->linkTo($CODEAppID, '') . 'proxy.php';
$absoluteUrl = $urlGenerator->getAbsoluteURL($relativeUrl);
- $wopi_url = $absoluteUrl . '?req=';
+ $new_wopi_url = $absoluteUrl . '?req=';
- $appConfig->setAppValue('wopi_url', $wopi_url);
+ // Check if the wopi url needs to be updated
+ if ($isCODEEnabled && $wopi_url === $new_wopi_url) {
+ return;
+ }
+
+ $appConfig->setAppValue('wopi_url', $new_wopi_url);
$appConfig->setAppValue('disable_certificate_verification', 'yes');
$discoveryManager = $this->getContainer()->query(DiscoveryManager::class);