Skip to content

Commit

Permalink
All webdav endpoints within remote.php are now hardcoded - helps to p…
Browse files Browse the repository at this point in the history
…revent migration issues like #23610 - furthermore there is no need to dynamically lookup all the endpoints we already know
  • Loading branch information
DeepDiver1975 committed Apr 5, 2016
1 parent 961bb4c commit 7bdde98
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
11 changes: 0 additions & 11 deletions apps/dav/appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,6 @@
<types>
<filesystem/>
</types>
<remote>
<files>appinfo/v1/webdav.php</files>
<webdav>appinfo/v1/webdav.php</webdav>
<dav>appinfo/v2/remote.php</dav>
<!-- carddav endpoints as used before ownCloud 9.0 -->
<contacts>appinfo/v1/carddav.php</contacts>
<carddav>appinfo/v1/carddav.php</carddav>
<!-- caldav endpoints as used before ownCloud 9.0 -->
<calendar>appinfo/v1/caldav.php</calendar>
<caldav>appinfo/v1/caldav.php</caldav>
</remote>
<public>
<webdav>appinfo/v1/publicwebdav.php</webdav>
</public>
Expand Down
23 changes: 22 additions & 1 deletion remote.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,27 @@ function handleException(Exception $e) {
}
}

/**
* @param $service
* @return string
*/
function resolveService($service) {
$services = [
'webdav' => 'dav/appinfo/v1/webdav.php',
'dav' => 'dav/appinfo/v2/remote.php',
'caldav' => 'dav/appinfo/v1/caldav.php',
'calendar' => 'dav/appinfo/v1/caldav.php',
'carddav' => 'dav/appinfo/v1/carddav.php',
'contacts' => 'dav/appinfo/v1/carddav.php',
'files' => 'dav/appinfo/v1/webdav.php',
];
if (isset($services[$service])) {
return $services[$service];
}

return \OC::$server->getConfig()->getAppValue('core', 'remote_' . $service);
}

try {
require_once 'lib/base.php';

Expand All @@ -103,7 +124,7 @@ function handleException(Exception $e) {
}
$service=substr($pathInfo, 1, $pos-1);

$file = \OC::$server->getConfig()->getAppValue('core', 'remote_' . $service);
$file = resolveService($service);

if(is_null($file)) {
throw new RemoteException('Path not found', OC_Response::STATUS_NOT_FOUND);
Expand Down

0 comments on commit 7bdde98

Please sign in to comment.