Skip to content

Commit a36a662

Browse files
committed
bugfix
1 parent 43f7c48 commit a36a662

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

caldav/davclient.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,11 @@ def __init__(
9494

9595
content_type = self.headers.get("Content-Type", "")
9696
xml = ["text/xml", "application/xml"]
97-
no_xml = ["text/plain", "text/calendar"]
97+
no_xml = ["text/plain", "text/calendar", "application/octet-stream"]
9898
expect_xml = any((content_type.startswith(x) for x in xml))
99-
expect_no_xml = any((content_type.startswith(x) for x in no_xml)) or response.status_code>399
99+
expect_no_xml = any((content_type.startswith(x) for x in no_xml))
100+
if content_type and not expect_xml and not expect_no_xml:
101+
error.weirdness(f"Unexpected content type: {content_type}")
100102
try:
101103
content_length = int(self.headers["Content-Length"])
102104
except:
@@ -905,6 +907,8 @@ def auto_conn(
905907
error.weirdness("traceback from client()")
906908
except ImportError:
907909
pass
910+
finally:
911+
sys.path = sys.path[2:]
908912

909913
if environment:
910914
raise NotImplementedError(

0 commit comments

Comments
 (0)