diff --git a/packages/web-integration-oc10/lib/Controller/FilesController.php b/packages/web-integration-oc10/lib/Controller/FilesController.php
index f041ec9ad73..5b022d9a23a 100644
--- a/packages/web-integration-oc10/lib/Controller/FilesController.php
+++ b/packages/web-integration-oc10/lib/Controller/FilesController.php
@@ -141,29 +141,16 @@ private function applyCSPOnlyOffice(ContentSecurityPolicy $csp): ContentSecurity
     }
 
     /**
-     * Extracts the onlyoffice document server URL from the app-config or system-config, in the same manner
-     * like the onlyoffice connector app:
-     * - https://github.com/ONLYOFFICE/onlyoffice-owncloud/blob/34f69c833ee4b00880d538aed1ecc48025ac8791/lib/appconfig.php#L379
-     * - https://github.com/ONLYOFFICE/onlyoffice-owncloud/blob/34f69c833ee4b00880d538aed1ecc48025ac8791/lib/appconfig.php#L278
+     * Extracts the onlyoffice document server URL from the app
      *
      * @return string
      */
     private function getOnlyOfficeDocumentServerUrl(): string {
-        $appName = 'onlyoffice';
-        $documentServerKey = 'DocumentServerUrl';
-        $documentServerUrl = $this->config->getAppValue($appName, $documentServerKey);
-        if (!empty($documentServerUrl)) {
-            return $documentServerUrl;
-        }
-        $documentServerUrl = $this->config->getSystemValue($documentServerKey);
-        if (!empty($documentServerUrl)) {
-            return $documentServerUrl;
-        }
-        $onlyOfficeConfig = $this->config->getSystemValue($appName);
-        if (\is_array($onlyOfficeConfig) && \array_key_exists($documentServerKey, $onlyOfficeConfig)) {
-            return $onlyOfficeConfig[$documentServerKey];
+        if (!class_exists("\OCA\Onlyoffice\AppConfig")) {
+            return "";
         }
-        return "";
+        $onlyofficeConfig = new \OCA\Onlyoffice\AppConfig("onlyoffice");
+        return $onlyofficeConfig->GetDocumentServerUrl();
     }
 
     private function applyCSPRichDocuments(ContentSecurityPolicy $csp): ContentSecurityPolicy {