From 36918232c00299f4b642618c8ada39d15d5ad0d0 Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Thu, 23 Feb 2012 16:20:21 +0100 Subject: [PATCH] Better detection of vcards --- radicale/ical.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/radicale/ical.py b/radicale/ical.py index fbf2d4b..18164d6 100644 --- a/radicale/ical.py +++ b/radicale/ical.py @@ -390,12 +390,17 @@ class Collection(object): with self.props as props: if "tag" not in props: try: - props["tag"] = open(self.path).readlines()[0][6:].rstrip() + tag = open(self.path).readlines()[0][6:].rstrip() except IOError: if self.path.endswith(".vcf"): props["tag"] = "VADDRESSBOOK" else: props["tag"] = "VCALENDAR" + else: + if tag in ("VADDRESSBOOK", "VCARD"): + props["tag"] = "VADDRESSBOOK" + else: + props["tag"] = "VCALENDAR" return props["tag"] @property