Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/federatedfilesharing/lib/Controller/OcmController.php
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ public function processNotification($notificationType,
*/
protected function getProtocols() {
return [
'webdav' => '/public.php/webdav/'
'webdav' => $this->urlGenerator->getAbsoluteURL('/public.php/webdav/')
];
}

Expand Down
19 changes: 18 additions & 1 deletion apps/files_sharing/lib/External/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,25 @@ protected function init() {
$this->memcacheFactory,
\OC::$server->getHTTPClientService()
);
$webDavEndpoint = $discoveryManager->getWebDavEndpoint($this->remote);
// OCM endpoint is absolute, OC legacy is relative
$isOcmWebDavEndpoint = \preg_match('#https?://#', $webDavEndpoint) === 1;
if ($isOcmWebDavEndpoint) {
// proto is anything before ://
// host starts just after a proto and ends before the first slash
// root starts from the first slash until the end and could be empty
\preg_match_all(
'#^(?<proto>https?)://(?<host>[^/]*)(?<root>.*)$#',
$webDavEndpoint,
$matches
);
$this->secure = $matches['proto'][0] === 'https';
$this->host = $matches['host'][0];
$this->root = isset($matches['root'][0]) ? $matches['root'][0] : '/';
} else {
$this->root = \rtrim($this->root, '/') . $webDavEndpoint;
}

$this->root = \rtrim($this->root, '/') . $discoveryManager->getWebDavEndpoint($this->remote);
if (!$this->root || $this->root[0] !== '/') {
$this->root = '/' . $this->root;
}
Expand Down