aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorskjnldsv <skjnldsv@protonmail.com>2024-12-17 15:23:59 +0100
committerskjnldsv <skjnldsv@protonmail.com>2024-12-17 15:23:59 +0100
commitb356cba2a64b841c8c8f2c3f518bdc5f9464a95a (patch)
tree246dd13b9d80d412e2f55fa4170fe9934cd1cac4 /lib
parent164af6229c8978be40f7034e9da51ffac05da77a (diff)
downloadnextcloud-server-b356cba2a64b841c8c8f2c3f518bdc5f9464a95a.tar.gz
nextcloud-server-b356cba2a64b841c8c8f2c3f518bdc5f9464a95a.zip
fix: make sure we have a valid scheme when testing ocm urlsfix/ocm-host
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/OCM/OCMDiscoveryService.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/private/OCM/OCMDiscoveryService.php b/lib/private/OCM/OCMDiscoveryService.php
index 377861b2eef..1fda1b1dac1 100644
--- a/lib/private/OCM/OCMDiscoveryService.php
+++ b/lib/private/OCM/OCMDiscoveryService.php
@@ -9,6 +9,7 @@ declare(strict_types=1);
namespace OC\OCM;
+use GuzzleHttp\Exception\ConnectException;
use JsonException;
use OCP\AppFramework\Http;
use OCP\Http\Client\IClientService;
@@ -52,6 +53,14 @@ class OCMDiscoveryService implements IOCMDiscoveryService {
*/
public function discover(string $remote, bool $skipCache = false): IOCMProvider {
$remote = rtrim($remote, '/');
+ if (!str_starts_with($remote, 'http://') && !str_starts_with($remote, 'https://')) {
+ // if scheme not specified, we test both;
+ try {
+ return $this->discover('https://' . $remote, $skipCache);
+ } catch (OCMProviderException|ConnectException) {
+ return $this->discover('http://' . $remote, $skipCache);
+ }
+ }
if (!$skipCache) {
try {