Skip to content

Commit 4ac416e

Browse files
enriquepablomickenordin
authored andcommitted
fix: backwards compatibility for shares for instances before upgrading
Signed-off-by: Enrique Pérez Arnaud <enrique@cazalla.net>
1 parent 332bb16 commit 4ac416e

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

apps/files_sharing/lib/External/Storage.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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,

lib/private/Files/Storage/DAV.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ class DAV extends Common {
132132
'{DAV:}getcontenttype',
133133
'{http://owncloud.org/ns}permissions',
134134
'{http://open-collaboration-services.org/ns}share-permissions',
135+
'{http://open-cloud-mesh.org/ns}share-permissions',
135136
'{DAV:}resourcetype',
136137
'{DAV:}getetag',
137138
'{DAV:}quota-available-bytes',

0 commit comments

Comments
 (0)