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 @@ -103,8 +103,25 @@ protected function init() {
103103 $ this ->memcacheFactory ,
104104 \OC ::$ server ->getHTTPClientService ()
105105 );
106+ $ webDavEndpoint = $ discoveryManager ->getWebDavEndpoint ($ this ->remote );
107+ // OCM endpoint is absolute, OC legacy is relative
108+ $ isOcmWebDavEndpoint = \preg_match ('#https?://# ' , $ webDavEndpoint ) === 1 ;
109+ if ($ isOcmWebDavEndpoint ) {
110+ // proto is anything before ://
111+ // host starts just after a proto and ends before the first slash
112+ // root starts from the first slash until the end and could be empty
113+ \preg_match_all (
114+ '#^(?<proto>https?)://(?<host>[^/]*)(?<root>.*)$# ' ,
115+ $ webDavEndpoint ,
116+ $ matches
117+ );
118+ $ this ->secure = $ matches ['proto ' ][0 ] === 'https ' ;
119+ $ this ->host = $ matches ['host ' ][0 ];
120+ $ this ->root = isset ($ matches ['root ' ][0 ]) ? $ matches ['root ' ][0 ] : '/ ' ;
121+ } else {
122+ $ this ->root = \rtrim ($ this ->root , '/ ' ) . $ webDavEndpoint ;
123+ }
106124
107- $ this ->root = \rtrim ($ this ->root , '/ ' ) . $ discoveryManager ->getWebDavEndpoint ($ this ->remote );
108125 if (!$ this ->root || $ this ->root [0 ] !== '/ ' ) {
109126 $ this ->root = '/ ' . $ this ->root ;
110127 }
You can’t perform that action at this time.
0 commit comments