From b45d3ced79b5a20034c85973760e2f120e1574e7 Mon Sep 17 00:00:00 2001
From: Robin Appelman <icewind@owncloud.com>
Date: Fri, 13 Jul 2012 22:44:35 +0200
Subject: [PATCH] fix remote and public.php

---
 apps/calendar/appinfo/version      |  2 +-
 apps/contacts/appinfo/version      |  2 +-
 apps/files/appinfo/version         |  2 +-
 apps/files_sharing/appinfo/version |  2 +-
 apps/gallery/appinfo/version       |  2 +-
 apps/media/appinfo/version         |  2 +-
 lib/app.php                        |  2 +-
 public.php                         |  1 +
 remote.php                         | 10 ++++------
 9 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/apps/calendar/appinfo/version b/apps/calendar/appinfo/version
index 2eb3c4fe4ee..cb0c939a936 100644
--- a/apps/calendar/appinfo/version
+++ b/apps/calendar/appinfo/version
@@ -1 +1 @@
-0.5
+0.5.2
diff --git a/apps/contacts/appinfo/version b/apps/contacts/appinfo/version
index 7dff5b89211..373f8c6f073 100644
--- a/apps/contacts/appinfo/version
+++ b/apps/contacts/appinfo/version
@@ -1 +1 @@
-0.2.1
\ No newline at end of file
+0.2.3
\ No newline at end of file
diff --git a/apps/files/appinfo/version b/apps/files/appinfo/version
index 8cfbc905b39..9c1218c201f 100644
--- a/apps/files/appinfo/version
+++ b/apps/files/appinfo/version
@@ -1 +1 @@
-1.1.1
\ No newline at end of file
+1.1.3
\ No newline at end of file
diff --git a/apps/files_sharing/appinfo/version b/apps/files_sharing/appinfo/version
index 7dff5b89211..f4778493c50 100644
--- a/apps/files_sharing/appinfo/version
+++ b/apps/files_sharing/appinfo/version
@@ -1 +1 @@
-0.2.1
\ No newline at end of file
+0.2.2
\ No newline at end of file
diff --git a/apps/gallery/appinfo/version b/apps/gallery/appinfo/version
index 8f0916f768f..4b9fcbec101 100644
--- a/apps/gallery/appinfo/version
+++ b/apps/gallery/appinfo/version
@@ -1 +1 @@
-0.5.0
+0.5.1
diff --git a/apps/media/appinfo/version b/apps/media/appinfo/version
index e6adf3fc7bb..44bb5d1f743 100644
--- a/apps/media/appinfo/version
+++ b/apps/media/appinfo/version
@@ -1 +1 @@
-0.4
\ No newline at end of file
+0.4.1
\ No newline at end of file
diff --git a/lib/app.php b/lib/app.php
index 4c2c43ec26b..caf8bd82521 100755
--- a/lib/app.php
+++ b/lib/app.php
@@ -608,7 +608,7 @@ class OC_App{
 		//set remote/public handelers
 		$appData=self::getAppInfo($appid);
 		foreach($appData['remote'] as $name=>$path){
-			OCP\CONFIG::setAppValue('core', 'remote_'.$name, $path);
+			OCP\CONFIG::setAppValue('core', 'remote_'.$name, $appid.'/'.$path);
 		}
 		foreach($appData['public'] as $name=>$path){
 			OCP\CONFIG::setAppValue('core', 'public_'.$name, $appid.'/'.$path);
diff --git a/public.php b/public.php
index 8846769f467..8383f36a246 100644
--- a/public.php
+++ b/public.php
@@ -10,6 +10,7 @@ if(is_null($file)){
 
 $parts=explode('/',$file,2);
 $app=$parts[0];
+
 OC_Util::checkAppEnabled($app);
 OC_App::loadApp($app);
 
diff --git a/remote.php b/remote.php
index bdce867aaba..8c02c24e2a3 100644
--- a/remote.php
+++ b/remote.php
@@ -15,27 +15,25 @@ if (!$pos = strpos($path_info, '/', 1)) {
 	$pos = strlen($path_info);
 }
 $service=substr($path_info, 1, $pos-1);
+
 $file = OC_AppConfig::getValue('core', 'remote_' . $service);
-$file = preg_replace('/apps\//','', $file); //Todo Remove after Multiappdir migration
 
 if(is_null($file)){
 	OC_Response::setStatus(OC_Response::STATUS_NOT_FOUND);
 	exit;
 }
 
-$file = ltrim ($file, '/');
-
 $parts=explode('/', $file, 2);
 $app=$parts[0];
 switch ($app) {
+	case 'core':
+		$file =  OC::$SERVERROOT .'/'. $file;
+		break;
 	default:
 		OC_Util::checkAppEnabled($app);
 		OC_App::loadApp($app);
 		$file = OC_App::getAppPath($app) .'/'. $parts[1];
 		break;
-	case 'core':
-		$file =  OC::$SERVERROOT .'/'. $file;
-		break;
 }
 $baseuri = OC::$WEBROOT . '/remote.php/'.$service.'/';
 require_once($file);
-- 
GitLab