瀏覽代碼

Fix crash when fetching nonexistent href

Markus Unterwaditzer 10 年之前
父節點
當前提交
472d016d1e
共有 1 個文件被更改,包括 4 次插入3 次删除
  1. 4 3
      radicale/xmlutils.py

+ 4 - 3
radicale/xmlutils.py

@@ -522,13 +522,14 @@ def report(path, xml_request, collection):
         if name:
             # Reference is an item
             path = "/".join(hreference.split("/")[:-1]) + "/"
-            try:
-                items = [collection.get(name)]
-            except KeyError:
+            item = collection.get(name)
+            if item is None:
                 multistatus.append(
                     _item_response(hreference, found_item=False))
                 continue
 
+            items = [item]
+
         else:
             # Reference is a collection
             path = hreference