[Pkg-owncloud-commits] [owncloud] 16/32: Fix webroot for update page

David Prévot taffit at moszumanska.debian.org
Sun Dec 15 01:47:32 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit dd7b074dfa05ca28523ad8e5431735c27400d360
Author: Vincent Petry <pvince81 at owncloud.com>
Date:   Fri Dec 13 12:54:08 2013 +0100

    Fix webroot for update page
    
    On the update page, config.js was missing which caused oc_webroot to not
    be available. That would trigger the faulty oc_webroot fallback that
    didn't take URLs like "/owncloud/index.php/files/apps" into account.
    
    This fix adds config.js in the update page and also a fix for the
    oc_webroot fallback, in case it is used elsewhere.
    
    Backport of df1a404
---
 core/js/js.js | 9 ++++++++-
 lib/base.php  | 1 +
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/core/js/js.js b/core/js/js.js
index d9b3b54..5442039 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -12,7 +12,14 @@ var oc_current_user = document.getElementsByTagName('head')[0].getAttribute('dat
 var oc_requesttoken = document.getElementsByTagName('head')[0].getAttribute('data-requesttoken');
 
 if (typeof oc_webroot === "undefined") {
-	oc_webroot = location.pathname.substr(0, location.pathname.lastIndexOf('/'));
+	oc_webroot = location.pathname;
+	var pos = oc_webroot.indexOf('/index.php/');
+	if (pos !== -1) {
+		oc_webroot = oc_webroot.substr(0, pos);
+	}
+	else {
+		oc_webroot = oc_webroot.substr(0, oc_webroot.lastIndexOf('/'));
+	}
 }
 if (oc_debug !== true || typeof console === "undefined" || typeof console.log === "undefined") {
 	if (!window.console) {
diff --git a/lib/base.php b/lib/base.php
index baf73b2..a6033f0 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -265,6 +265,7 @@ class OC {
 					$minimizerCSS->clearCache();
 					$minimizerJS = new OC_Minimizer_JS();
 					$minimizerJS->clearCache();
+					OC_Util::addScript('config'); // needed for web root
 					OC_Util::addScript('update');
 					$tmpl = new OC_Template('', 'update.admin', 'guest');
 					$tmpl->assign('version', OC_Util::getVersionString());

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list