瀏覽代碼

Merge pull request #418 from Unrud/patch-15

Fix crash on unknown content type
Guillaume Ayoub 9 年之前
父節點
當前提交
146eb99887
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      radicale/__init__.py

+ 3 - 1
radicale/__init__.py

@@ -533,7 +533,9 @@ class Application:
         content_type = environ.get("CONTENT_TYPE")
         if content_type:
             tags = {value: key for key, value in storage.MIMETYPES.items()}
-            collection.set_meta("tag", tags[content_type.split(";")[0]])
+            tag = tags.get(content_type.split(";")[0])
+            if tag:
+                collection.set_meta("tag", tag)
         headers = {}
         item_name = xmlutils.name_from_path(environ["PATH_INFO"], collection)
         item = collection.get(item_name)