Skip to content

Commit

Permalink
core: services: bag: Verify if the data is valid before writing it
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
  • Loading branch information
patrickelectric authored and rafaellehmkuhl committed Jun 28, 2024
1 parent f8253c6 commit 1a2b977
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/services/bag_of_holding/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ def read_db() -> Any:


def write_db(data: Dict[str, Any]) -> None:
# Just to be sure that we'll be able to load it later
json_string = json.dumps(data)
json.loads(json_string)

with open(FILE_PATH, "w", encoding="utf-8") as f:
json.dump(data, f)

Expand Down

0 comments on commit 1a2b977

Please sign in to comment.