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:
authorJulius Härtl <jus@bitgrid.net>2020-12-03 10:16:20 +0300
committerGitHub <noreply@github.com>2020-12-03 10:16:20 +0300
commitf27c48e5a4cdd1d6546728ed9c20773d7d11064b (patch)
tree9e3b80c5daf978d54a84e0d54a3fc9a876f904b7 /lib
parentf8bc3ec4f8ea1d2efeaf180132c2c7c6d21b6425 (diff)
parentcb4653c934de161731a42ba00e626ffcbec8e480 (diff)
Merge pull request #1256 from mrkara/kara/adapt-to-host-url-change
Adapt built-in CODE url on host address change
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 044e7ab4..7e86f801 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -188,18 +188,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);