mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-19 12:24:46 +08:00
fix: issue 1138 windows encoding (#1139)
* fix(windows): use utf-8 for text file operations * fix(windows): normalize sandbox path masking * fix(windows): preserve utf-8 handling after backend split
This commit is contained in:
@@ -58,3 +58,31 @@ unsupported: true
|
||||
assert valid is False
|
||||
assert "unsupported" in message
|
||||
assert skill_name is None
|
||||
|
||||
|
||||
def test_validate_skill_frontmatter_reads_utf8_on_windows_locale(tmp_path, monkeypatch) -> None:
|
||||
skill_dir = tmp_path / "demo-skill"
|
||||
_write_skill(
|
||||
skill_dir,
|
||||
"""---
|
||||
name: demo-skill
|
||||
description: "Curly quotes: \u201cutf8\u201d"
|
||||
---
|
||||
|
||||
# Demo Skill
|
||||
""",
|
||||
)
|
||||
|
||||
original_read_text = Path.read_text
|
||||
|
||||
def read_text_with_gbk_default(self, *args, **kwargs):
|
||||
kwargs.setdefault("encoding", "gbk")
|
||||
return original_read_text(self, *args, **kwargs)
|
||||
|
||||
monkeypatch.setattr(Path, "read_text", read_text_with_gbk_default)
|
||||
|
||||
valid, message, skill_name = VALIDATE_SKILL_FRONTMATTER(skill_dir)
|
||||
|
||||
assert valid is True
|
||||
assert message == "Skill is valid!"
|
||||
assert skill_name == "demo-skill"
|
||||
|
||||
Reference in New Issue
Block a user