getUrlSrc($appName)['urlsrc']; // Fix for potentially escaped urls that are misconfigured on the Collabora docker image // https://github.com/f7cloud/richdocuments/issues/3262 $result = str_replace('\.', '.', $result); return (string)$result; } /** * @throws Exception */ private function getUrlSrc(string $mimetype): array { $discovery = $this->discoveryService->get(); $this->logger->debug('WOPI::getUrlSrc discovery: {discovery}', ['discovery' => $discovery]); $discoveryParsed = simplexml_load_string($discovery); $result = $discoveryParsed->xpath(sprintf('/wopi-discovery/net-zone/app[@name=\'%s\']/action', $mimetype)); if ($result && count($result) > 0) { return [ 'urlsrc' => (string)$result[0]['urlsrc'], 'action' => (string)$result[0]['name'], ]; } $this->logger->error('Didn\'t find urlsrc for mimetype {mimetype} in this WOPI discovery response: {discovery}', ['mimetype' => $mimetype, 'discovery' => $discovery]); throw new Exception('Could not find urlsrc for ' . $mimetype . ' in WOPI discovery response'); } }