From 8fed92dc2467f4fdcb31170cd1d8fb90710c3070 Mon Sep 17 00:00:00 2001 From: Unrud Date: Thu, 1 Jun 2017 12:04:25 +0200 Subject: [PATCH] Fix absolute paths in web interface when SCRIPT_NAME is used --- radicale/web/fn.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/radicale/web/fn.js b/radicale/web/fn.js index b464790..cc313e3 100644 --- a/radicale/web/fn.js +++ b/radicale/web/fn.js @@ -17,13 +17,19 @@ */ /** - * Server address (must not end with /) + * Server address * @const * @type {string} */ var SERVER = (location.protocol + '//' + location.hostname + - (location.port ? ':' + location.port : '') + - location.pathname.replace(new RegExp("/+[^/]+/*(/index\.html?)?$"), "")); + (location.port ? ':' + location.port : '')); + +/** + * Path of the root collection on the server (must end with /) + * @const + * @type {string} + */ +var ROOT_PATH = location.pathname.replace(new RegExp("/+[^/]+/*(/index\.html?)?$"), "") + '/'; /** * time between updates of collections. @@ -121,7 +127,7 @@ function Collection(href, type, displayname, description, color) { */ function get_principal(user, password, callback) { var request = new XMLHttpRequest(); - request.open("PROPFIND", SERVER, true, user, password); + request.open("PROPFIND", SERVER + ROOT_PATH, true, user, password); request.onreadystatechange = function() { if (request.readyState !== 4) { return;