mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-08-07 01:48:53 +00:00
fix: sanitize Matrix user_id for Windows-safe store file names
- Replace ':' with '_' in store_name to avoid WinError 123 - Pass sanitized store_name via AsyncClientConfig - Fixes issue #3506 where Matrix channel fails on Windows due to colon in user_id causing invalid file paths in matrix-nio's DefaultStore
This commit is contained in:
parent
2b9b41f9c3
commit
95715f5211
@ -262,10 +262,18 @@ class MatrixChannel(BaseChannel):
|
|||||||
self.store_path.mkdir(parents=True, exist_ok=True)
|
self.store_path.mkdir(parents=True, exist_ok=True)
|
||||||
self.session_path = self.store_path / "session.json"
|
self.session_path = self.store_path / "session.json"
|
||||||
|
|
||||||
|
# Replace ':' with '_' to produce a Windows-safe filename
|
||||||
|
safe_store_name = self.config.user_id.replace(":", "_") + f"_{self.config.device_id}.db"
|
||||||
|
|
||||||
self.client = AsyncClient(
|
self.client = AsyncClient(
|
||||||
homeserver=self.config.homeserver, user=self.config.user_id,
|
homeserver=self.config.homeserver,
|
||||||
|
user=self.config.user_id,
|
||||||
store_path=self.store_path,
|
store_path=self.store_path,
|
||||||
config=AsyncClientConfig(store_sync_tokens=True, encryption_enabled=self.config.e2ee_enabled),
|
config=AsyncClientConfig(
|
||||||
|
store_sync_tokens=True,
|
||||||
|
encryption_enabled=self.config.e2ee_enabled,
|
||||||
|
store_name=safe_store_name,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
self._register_event_callbacks()
|
self._register_event_callbacks()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user