From bae592d69b59462ed2ed50b132f391fd149d9f76 Mon Sep 17 00:00:00 2001
From: Bart Visscher <bartv@thisnet.nl>
Date: Wed, 20 Jun 2012 17:10:17 +0200
Subject: [PATCH] Prefer requested app before redirecting to default page

---
 lib/util.php | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/util.php b/lib/util.php
index 58d6ab1be7..5cd66ca12e 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -326,7 +326,11 @@ class OC_Util {
 		OC_Log::write('core','redirectToDefaultPage',OC_Log::DEBUG);
 		if(isset($_REQUEST['redirect_url']) && (substr($_REQUEST['redirect_url'], 0, strlen(OC::$WEBROOT)) == OC::$WEBROOT || $_REQUEST['redirect_url'][0] == '/')) {
 			header( 'Location: '.$_REQUEST['redirect_url']);
-		} else {
+		}
+		else if (isset(OC::$REQUESTEDAPP) && !empty(OC::$REQUESTEDAPP)) {
+			header( 'Location: '.OC::$WEBROOT.'/?app='.OC::$REQUESTEDAPP );
+		}
+		else {
 			header( 'Location: '.OC::$WEBROOT.'/'.OC_Appconfig::getValue('core', 'defaultpage', '?app=files'));
 		}
 		exit();
-- 
GitLab