From 7bdde98617ad3c7f56dced1add0a155f4a0e5a2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Tue, 5 Apr 2016 09:59:43 +0200 Subject: [PATCH] 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 --- apps/dav/appinfo/info.xml | 11 ----------- remote.php | 23 ++++++++++++++++++++++- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/apps/dav/appinfo/info.xml b/apps/dav/appinfo/info.xml index b7c7267dce..a8e7df6e8e 100644 --- a/apps/dav/appinfo/info.xml +++ b/apps/dav/appinfo/info.xml @@ -10,17 +10,6 @@ - - appinfo/v1/webdav.php - appinfo/v1/webdav.php - appinfo/v2/remote.php - - appinfo/v1/carddav.php - appinfo/v1/carddav.php - - appinfo/v1/caldav.php - appinfo/v1/caldav.php - appinfo/v1/publicwebdav.php diff --git a/remote.php b/remote.php index df229eb675..86b47629d7 100644 --- a/remote.php +++ b/remote.php @@ -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'; @@ -103,7 +124,7 @@ try { } $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);