mirror of
https://github.com/nextcloud/server.git
synced 2026-02-18 18:28:50 -05:00
Merge pull request #49900 from nextcloud/fix/ocm-host
This commit is contained in:
commit
8e7ce5cb71
1 changed files with 9 additions and 0 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue