aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorskjnldsv <skjnldsv@protonmail.com>2024-12-17 15:23:59 +0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-12-17 15:47:54 +0000
commitfd558fd62ed094ae43425b7860732f358c0d2dca (patch)
tree0d3cd5fc5508a1a0232e1885f19c146dc8ad7c57 /lib/private
parent4f74901edabe14c400931db6f431ca6ee5ceb24b (diff)
downloadnextcloud-server-backport/49900/stable29.tar.gz
nextcloud-server-backport/49900/stable29.zip
fix: make sure we have a valid scheme when testing ocm urlsbackport/49900/stable29
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Diffstat (limited to 'lib/private')
-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 dd2f3d4e058..9c84a58c305 100644
--- a/lib/private/OCM/OCMDiscoveryService.php
+++ b/lib/private/OCM/OCMDiscoveryService.php
@@ -26,6 +26,7 @@ declare(strict_types=1);
namespace OC\OCM;
+use GuzzleHttp\Exception\ConnectException;
use JsonException;
use OCP\AppFramework\Http;
use OCP\Http\Client\IClientService;
@@ -69,6 +70,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 {