浏览代码

Don't crash if propsfile doesn't exist

Markus Unterwaditzer 10 年之前
父节点
当前提交
a1cdcf2fba
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      radicale/storage.py

+ 1 - 1
radicale/storage.py

@@ -349,7 +349,7 @@ class Collection:
             with open(props_path, encoding=STORAGE_ENCODING) as prop_file:
                 properties.update(json.load(prop_file))
         properties[key] = value
-        with open(props_path, "w", encoding=STORAGE_ENCODING) as prop_file:
+        with open(props_path, "w+", encoding=STORAGE_ENCODING) as prop_file:
             json.dump(properties, prop_file)
 
     @property