Ver Fonte

fix(OCM): Fix OCM provider discovery for servers without beautiful URLs

Signed-off-by: Joas Schilling <coding@schilljs.com>
Joas Schilling há 6 meses atrás
pai
commit
4424918313
1 ficheiros alterados com 4 adições e 1 exclusões
  1. 4 1
      lib/private/OCM/OCMDiscoveryService.php

+ 4 - 1
lib/private/OCM/OCMDiscoveryService.php

@@ -69,6 +69,9 @@ class OCMDiscoveryService implements IOCMDiscoveryService {
 	 */
 	 */
 	public function discover(string $remote, bool $skipCache = false): IOCMProvider {
 	public function discover(string $remote, bool $skipCache = false): IOCMProvider {
 		$remote = rtrim($remote, '/');
 		$remote = rtrim($remote, '/');
+		if (str_ends_with($remote, '/index.php')) {
+			$remote = substr($remote, 0, -10);
+		}
 
 
 		if (!$skipCache) {
 		if (!$skipCache) {
 			try {
 			try {
@@ -84,7 +87,7 @@ class OCMDiscoveryService implements IOCMDiscoveryService {
 		$client = $this->clientService->newClient();
 		$client = $this->clientService->newClient();
 		try {
 		try {
 			$response = $client->get(
 			$response = $client->get(
-				$remote . '/ocm-provider/',
+				$remote . '/index.php/ocm-provider/',
 				[
 				[
 					'timeout' => 10,
 					'timeout' => 10,
 					'verify' => !$this->config->getSystemValueBool('sharing.federation.allowSelfSignedCertificates'),
 					'verify' => !$this->config->getSystemValueBool('sharing.federation.allowSelfSignedCertificates'),