aboutsummaryrefslogtreecommitdiffstats
path: root/core/src/OC/webroot.js
blob: cbe5a6190e1db2b9fc916c0f619dee129a56ab27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/**
 * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

let webroot = window._oc_webroot

if (typeof webroot === 'undefined') {
	webroot = location.pathname
	const pos = webroot.indexOf('/index.php/')
	if (pos !== -1) {
		webroot = webroot.substr(0, pos)
	} else {
		webroot = webroot.substr(0, webroot.lastIndexOf('/'))
	}
}

export default webroot