Преглед на файлове

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.