浏览代码

hash the state file name (#4000)

* hash the state file name

* forgot to digest my food oop
Khaleel Al-Adhami 7 月之前
父节点
当前提交
9d8b737b1a
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      reflex/state.py

+ 4 - 1
reflex/state.py

@@ -12,6 +12,7 @@ import os
 import uuid
 from abc import ABC, abstractmethod
 from collections import defaultdict
+from hashlib import md5
 from pathlib import Path
 from types import FunctionType, MethodType
 from typing import (
@@ -2704,7 +2705,9 @@ class StateManagerDisk(StateManager):
         Returns:
             The path for the token.
         """
-        return (self.states_directory / f"{token}.pkl").absolute()
+        return (
+            self.states_directory / f"{md5(token.encode()).hexdigest()}.pkl"
+        ).absolute()
 
     async def load_state(self, token: str, root_state: BaseState) -> BaseState:
         """Load a state object based on the provided token.