From 54bda5594c37320ac98af97e678222b42d3622f7 Mon Sep 17 00:00:00 2001 From: Fabrice Bellet Date: Mon, 22 Oct 2012 12:44:42 +0200 Subject: [PATCH] Handle use in a subdir. Patch from Clint Adams adapted from http://redmine.kozea.fr/issues/996 --- config | 3 ++- radicale/config.py | 3 ++- radicale/xmlutils.py | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/config b/config index 7b5702a1..6ddf1ceb 100644 --- a/config +++ b/config @@ -27,7 +27,8 @@ certificate = /etc/apache2/ssl/server.crt key = /etc/apache2/ssl/server.key # Reverse DNS to resolve client address in logs dns_lookup = True - +# base URL if / is not the CalDAV root +base_prefix = [encoding] # Encoding for responding requests diff --git a/radicale/config.py b/radicale/config.py index e07132e2..14964aa2 100644 --- a/radicale/config.py +++ b/radicale/config.py @@ -45,7 +45,8 @@ INITIAL_CONFIG = { "ssl": "False", "certificate": "/etc/apache2/ssl/server.crt", "key": "/etc/apache2/ssl/server.key", - "dns_lookup": "True"}, + "dns_lookup": "True", + "base_prefix": ""}, "encoding": { "request": "utf-8", "stock": "utf-8"}, diff --git a/radicale/xmlutils.py b/radicale/xmlutils.py index 7896a54b..29f131e6 100644 --- a/radicale/xmlutils.py +++ b/radicale/xmlutils.py @@ -227,6 +227,7 @@ def _propfind_response(path, item, props, user): href = ET.Element(_tag("D", "href")) uri = item.url if is_collection else "%s/%s" % (path, item.name) + uri = "%s/%s" % (config.get("server", "base_prefix"), uri) href.text = uri.replace("//", "/") response.append(href)