@@ -98,7 +98,14 @@ public function __construct($options) {
9898 }
9999
100100 $ host = parse_url ($ remote , PHP_URL_HOST );
101+ // If host extraction fails (e.g., endpoint has no scheme), fall back to cloudId's remote
102+ if ($ host === null ) {
103+ $ host = parse_url ($ this ->cloudId ->getRemote (), PHP_URL_HOST );
104+ }
101105 $ port = parse_url ($ remote , PHP_URL_PORT );
106+ if ($ port === null ) {
107+ $ port = parse_url ($ this ->cloudId ->getRemote (), PHP_URL_PORT );
108+ }
102109 $ host .= ($ port === null ) ? '' : ': ' . $ port ; // we add port if available
103110
104111 // in case remote NC is on a sub folder and using deprecated ocm provider
@@ -111,9 +118,12 @@ public function __construct($options) {
111118 $ this ->token = $ options ['token ' ];
112119 $ this ->tokenExpiresAt = (int )($ options ['access_token_expires ' ] ?? 0 );
113120
121+ // Determine scheme - fall back to cloudId's remote if $remote has no scheme
122+ $ scheme = parse_url ($ remote , PHP_URL_SCHEME ) ?? parse_url ($ this ->cloudId ->getRemote (), PHP_URL_SCHEME ) ?? 'https ' ;
123+
114124 parent ::__construct (
115125 [
116- 'secure ' => (( parse_url ( $ remote , PHP_URL_SCHEME ) ?? ' https ' ) === 'https ' ),
126+ 'secure ' => ($ scheme === 'https ' ),
117127 'verify ' => !$ this ->config ->getSystemValueBool ('sharing.federation.allowSelfSignedCertificates ' , false ),
118128 'host ' => $ host ,
119129 'root ' => $ webDavEndpoint ,
0 commit comments