Skip to content
Snippets Groups Projects
Commit 7bdde986 authored by Thomas Müller's avatar Thomas Müller
Browse files

All webdav endpoints within remote.php are now hardcoded - helps to prevent...

All webdav endpoints within remote.php are now hardcoded - helps to prevent migration issues like #23610 - furthermore there is no need to dynamically lookup all the endpoints we already know
parent 961bb4c3
No related branches found
No related tags found
No related merge requests found
...@@ -10,17 +10,6 @@ ...@@ -10,17 +10,6 @@
<types> <types>
<filesystem/> <filesystem/>
</types> </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> <public>
<webdav>appinfo/v1/publicwebdav.php</webdav> <webdav>appinfo/v1/publicwebdav.php</webdav>
</public> </public>
......
...@@ -84,6 +84,27 @@ function handleException(Exception $e) { ...@@ -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 { try {
require_once 'lib/base.php'; require_once 'lib/base.php';
...@@ -103,7 +124,7 @@ try { ...@@ -103,7 +124,7 @@ try {
} }
$service=substr($pathInfo, 1, $pos-1); $service=substr($pathInfo, 1, $pos-1);
$file = \OC::$server->getConfig()->getAppValue('core', 'remote_' . $service); $file = resolveService($service);
if(is_null($file)) { if(is_null($file)) {
throw new RemoteException('Path not found', OC_Response::STATUS_NOT_FOUND); throw new RemoteException('Path not found', OC_Response::STATUS_NOT_FOUND);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment