File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
federatedfilesharing/lib/Controller
files_sharing/lib/External Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -423,7 +423,7 @@ public function processNotification($notificationType,
423423 */
424424 protected function getProtocols () {
425425 return [
426- 'webdav ' => '/public.php/webdav/ '
426+ 'webdav ' => $ this -> urlGenerator -> getAbsoluteURL ( '/public.php/webdav/ ' )
427427 ];
428428 }
429429
Original file line number Diff line number Diff line change @@ -96,8 +96,25 @@ protected function init() {
9696 $ this ->memcacheFactory ,
9797 \OC ::$ server ->getHTTPClientService ()
9898 );
99+ $ webDavEndpoint = $ discoveryManager ->getWebDavEndpoint ($ this ->remote );
100+ // OCM endpoint is absolute, OC legacy is relative
101+ $ isOcmWebDavEndpoint = \preg_match ('#https?://# ' , $ webDavEndpoint ) === 1 ;
102+ if ($ isOcmWebDavEndpoint ) {
103+ // proto is anything before ://
104+ // host starts just after a proto and ends before the first slash
105+ // root starts from the first slash until the end and could be empty
106+ \preg_match_all (
107+ '#^(?<proto>https?)://(?<host>[^/]*)(?<root>.*)$# ' ,
108+ $ webDavEndpoint ,
109+ $ matches
110+ );
111+ $ this ->secure = $ matches ['proto ' ][0 ] === 'https ' ;
112+ $ this ->host = $ matches ['host ' ][0 ];
113+ $ this ->root = isset ($ matches ['root ' ][0 ]) ? $ matches ['root ' ][0 ] : '/ ' ;
114+ } else {
115+ $ this ->root = \rtrim ($ this ->root , '/ ' ) . $ webDavEndpoint ;
116+ }
99117
100- $ this ->root = \rtrim ($ this ->root , '/ ' ) . $ discoveryManager ->getWebDavEndpoint ($ this ->remote );
101118 if (!$ this ->root || $ this ->root [0 ] !== '/ ' ) {
102119 $ this ->root = '/ ' . $ this ->root ;
103120 }
You can’t perform that action at this time.
0 commit comments