diff options
author | Vincent Petry <pvince81@owncloud.com> | 2013-12-13 12:54:08 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2013-12-13 12:56:48 +0100 |
commit | df1a404466340700cfe16d4a57c2bd964290d35a (patch) | |
tree | ae2ed248126b1b437f158b8aa1bc9446baaf5c01 /core | |
parent | 3084a52a970c83ca35135f490b9bcb06b9900867 (diff) | |
download | nextcloud-server-df1a404466340700cfe16d4a57c2bd964290d35a.tar.gz nextcloud-server-df1a404466340700cfe16d4a57c2bd964290d35a.zip |
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.
Diffstat (limited to 'core')
-rw-r--r-- | core/js/js.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/core/js/js.js b/core/js/js.js index d9b3b54e0a1..5442039c294 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) { |