Browse Source

only read if it's *not* empty (#4165)

Khaleel Al-Adhami 7 tháng trước cách đây
mục cha
commit
0311dae568
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      reflex/utils/path_ops.py

+ 1 - 1
reflex/utils/path_ops.py

@@ -218,7 +218,7 @@ def update_json_file(file_path: str | Path, update_dict: dict[str, int | str]):
 
     # Read the existing json object from the file.
     json_object = {}
-    if fp.stat().st_size == 0:
+    if fp.stat().st_size:
         with open(fp) as f:
             json_object = json.load(f)